[Issue 1866] Couple of reflection bugs (.stringof)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Feb 24 15:37:56 PST 2008


http://d.puremagic.com/issues/show_bug.cgi?id=1866





------- Comment #1 from onlystupidspamhere at yahoo.se  2008-02-24 17:37 -------
Here's some test cases for the .tupleof. As you can see, there probably isn't
any way to pass .tupleof to a template as a parameter - it feels like it is
outside the D's type system. IMO it should return a tuple of compile time
aliases.

template tuple(T...) { alias T tuple; }

struct foo { int a; }

template aaa(a) { alias int aaa; }
template bbb(alias a) { alias int bbb; }
//template ccc(foo.tupleof a) { alias int ccc; } // Error: foo.tupleof is used
as a type
//template ddd(typeof(foo.tupleof) a) { alias int ddd; } // Error:
arithmetic/string type expected for value-parameter, not (int)
//template eee(tuple!(foo.tupleof) a) { alias int eee; } // Error:
tuple!(tuple(((foo ).a))) is used as a type
//template fff(tuple!(typeof(foo.tupleof)) a) { alias int fff; } // Error:
arithmetic/string type expected for value-parameter, not (int)

//pragma(msg, aaa!(foo.tupleof).stringof); // template instance
aaa!(tuple(((foo ).a))) does not match any template declaration
//pragma(msg, bbb!(foo.tupleof).stringof); // template instance
bbb!(tuple(((foo ).a))) does not match any template declaration

//pragma(msg, ccc!(foo.tupleof).stringof); // the templates above failed
//pragma(msg, ddd!(foo.tupleof).stringof);
//pragma(msg, eee!(foo.tupleof).stringof);
//pragma(msg, fff!(foo.tupleof).stringof);


-- 



More information about the Digitalmars-d-bugs mailing list