Issue 10190 - fullyQualifiedName on enum template members doesn't work
Summary: fullyQualifiedName on enum template members doesn't work
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P3 normal
Assignee: Dicebot
URL:
Keywords:
Depends on: 14501
Blocks:
  Show dependency treegraph
 
Reported: 2013-05-28 01:49 UTC by thelastmammoth
Modified: 2024-12-01 16:17 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description thelastmammoth 2013-05-28 01:49:08 UTC
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 ?
Comment 1 Dicebot 2013-05-28 02:20:00 UTC
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.
Comment 2 Dicebot 2013-05-28 02:38:03 UTC
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).
Comment 3 Dicebot 2013-06-14 01:24:26 UTC
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?
Comment 4 Andrej Mitrovic 2014-04-24 12:14:30 UTC
Seems similar to https://issues.dlang.org/show_bug.cgi?id=12287
Comment 5 ag0aep6g 2015-04-25 20:22:03 UTC
(In reply to Dicebot from comment #2)
> 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).

Filed that as issue 14501.
Comment 6 dlangBugzillaToGithub 2024-12-01 16:17:45 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/phobos/issues/9605

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB