This code currently compiles: int bar(); @bar() void foo(){} But this gives an error, as expected: int bar(); @bar() void foo(){} pragma(msg, __traits(getAttributes, foo)); I would expect the first example to give an error too. Is the current behavior deliberate or is it a DMD bug?