[Issue 10708] New: Class members as template alias parameters not CTFE-able
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jul 23 23:56:34 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10708
Summary: Class members as template alias parameters not
CTFE-able
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: johannespfau at gmail.com
--- Comment #0 from Johannes Pfau <johannespfau at gmail.com> 2013-07-23 23:56:33 PDT ---
Test case:
------------------------
class TestClass
{
int a;
this()
{
enum c = getAttribute!(TestClass.a);
}
}
int getAttribute(alias target)()
{
return 0;
}
------------------------
produces this error in DMD 2.063:
Error: value of 'this' is not known at compile time
This is annoying as you can use e.g. __traits(getAttributes, TestClass.a) but
you can not wrap this call into a template because of this bug.
A workaround as mentioned by Andrej Mitrovic is adding static to the
getAttribute template declaration.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list