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

--- Comment #3 from RazvanN <[email protected]> ---
(In reply to Max Samukha from comment #2)
> Would that break tons of reflective code like this?
> 
> // any template extracting compile-time info
> template hasAttr(alias symbol, alias attr) {
>       import std.meta;
>       enum _f(alias s) = __traits(isSame, s, attr);
>       alias hasAttr = anySatisfy!(_f, __traits(getAttributes, symbol));
> }
> 
> struct attr {
> }
> 
> int main() {
>       @attr int x;
>       static assert(hasAttr!(x, attr)); // wouldn't work anymore
>       return 0;
> }

Yes. I tried working out a particular solution where only dotId expressions
(such as the one on the original bug report) are excluded if the member is not
a static one and it still breaks code in the dmd testsuite. It really is a rats
nest.

--

Reply via email to