[Issue 14501] template result is reused for equal but non-identical alias arguments

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Jul 27 04:10:37 PDT 2017


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

RazvanN <razvan.nitu1305 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305 at gmail.com

--- Comment #1 from RazvanN <razvan.nitu1305 at gmail.com> ---
The problem here is that when the template is instantiated the compiler
basically generates, roughly,  the following code:

auto identifier(enum a)
{
    return __traits(identifier, a);
}

Subsequent calls to identifier which do not instantiate the template will just
use the already generated function (I'm not sure if a function is generated,
but that is not important here) thus making traits evaluate the identifier to
the first identifier that was used to instantiate the template.

--


More information about the Digitalmars-d-bugs mailing list