www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10190] New: fullyQualifiedName on enum template members doesn't work

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10190

           Summary: fullyQualifiedName on enum template members doesn't
                    work
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: thelastmammoth gmail.com



import std.stdio;
import std.traits;

template A(T){
    struct A{
        T x;
        void foo(int z){}
    }
}
void main(){
    enum b=A!int.init;
    auto c=A!int.init;
    writeln(fullyQualifiedName!(A!int.init));
    writeln(fullyQualifiedName!(b));
    writeln(fullyQualifiedName!(c));
}


prints:
T
T
tests.main.main.c

is that normal to print T ?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 28 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10190


Dicebot <m.strashun gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |m.strashun gmail.com



Looks like this was caused by my pull
https://github.com/D-Programming-Language/phobos/pull/1182

"(__traits(identifier, T)" is evaluated to "T" for some reasons with this
snippet. On it.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 28 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10190




Ok, there are two issues here.

First one is that identifier trait fails badly with temporaries, minimal
example:
----------------------------------------
template oops(alias T)
{
    enum oops = __traits(identifier, T); 
}

struct A {}

pragma(msg, oops!(A.init));

void main()
{
}
----------------------------------------

Second looks like some sort of data reusage compiler bug - once identifier
trait was called on a temporary, using it on normal symbols breaks too (yields
same rersult).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 28 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10190




I feel like I need an advice from someone from core DMD team on this - should I
try to detect and workaround incoming temporaries in std.traits code or this is
__traits(identifier) bug and need to be fixed in DMD itself?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 14 2013