www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19068] New: __traits(identifier) returns the wrong string


          Issue ID: 19068
           Summary: __traits(identifier) returns the wrong string when
                    importing a template from a module
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: atila.neves gmail.com

/// mod.d
auto identity(T)(T t) { return t; }

/// main.d
import mod;
alias identityInt = identity!int;
enum memberName = __traits(identifier, __traits(getMember, main,
static assert(memberName == "identityInt",
              "Expected 'identityInt', got '" ~ memberName ~ "'");

The static assert fails, with __traits(identifier) returning "identity" instead
of "identityInt".

Jul 06 2018