[Issue 13372] traits parent does not work on eponymous templates

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun May 24 17:24:28 UTC 2020


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

Adam D. Ruppe <destructionator at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |destructionator at gmail.com

--- Comment #5 from Adam D. Ruppe <destructionator at gmail.com> ---
Here's something related I just came upon:

template wrap(string foo) {
        enum wrap = foo;
}
pragma(msg, __traits(parent, wrap!"lol")); // says lol
pragma(msg, __traits(parent, __traits(parent, wrap!"lol"))); // says argument
"lol" has no parent


So in the first one, it appears it evaluates to the outer template which is
then instantly evaluated back to the enum literal. Then the second one sees the
literal and says literals have no parents.

Quite bizarre indeed.

--


More information about the Digitalmars-d-bugs mailing list