Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fullyQualifiedName on enum template members doesn't work #9605

Open
dlangBugzillaToGithub opened this issue May 28, 2013 · 5 comments
Open

Comments

@dlangBugzillaToGithub
Copy link

thelastmammoth reported this on 2013-05-28T01:49:08Z

Transfered from https://issues.dlang.org/show_bug.cgi?id=10190

CC List

Description

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 ?
@dlangBugzillaToGithub
Copy link
Author

public (@mihails-strasuns) commented on 2013-05-28T02:20:00Z

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.

@dlangBugzillaToGithub
Copy link
Author

public (@mihails-strasuns) commented on 2013-05-28T02:38:03Z

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).

@dlangBugzillaToGithub
Copy link
Author

public (@mihails-strasuns) commented on 2013-06-14T01:24:26Z

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?

@dlangBugzillaToGithub
Copy link
Author

andrej.mitrovich (@AndrejMitrovic) commented on 2014-04-24T12:14:30Z

Seems similar to https://issues.dlang.org/show_bug.cgi?id=12287

@dlangBugzillaToGithub
Copy link
Author

ag0aep6g commented on 2015-04-25T20:22:03Z

(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.

@LightBender LightBender removed the P3 label Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants