[Issue 22565] Attributes not accepted for empty declaration

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Dec 7 16:27:08 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=22565

--- Comment #4 from Răzvan Ștefănescu <rumbu at rumbu.ro> ---
UDAs can be attached to any declaration according to the grammar, not to a
symbol only. 

How useful is that, it's debatable, but there are situations where the fact
that attributes are attached to declarations, not to a symbol makes a huge
difference:

@attr
int a, b, c;

where @attr is applied to a, b and c, not to a only.

Also there is the unittest case where there is no symbol, but attributes can
have a meaning and can be obtained using __traits, see
https://dlang.org/spec/traits.html#getUnitTests

There are two options:
- dmd must eat his own food by implementing the existing grammar specification
or,
- the grammar must be adjusted to match the current situation;

Tizule, iute ești mă la mânie, ia-o mai ușor :)

--


More information about the Digitalmars-d-bugs mailing list