Behavioral description of latch
The code you show is a snippet of sequential code, and it may model a latch if the rest of the process is correct.

How about writing it in concurrent code?

Q &lt;= D when clk = '1';


Or, if you want to be extra terse and VHDL-2008 is an option:

Q &lt;= D when clk;