[Issue 9065] Please consider adding these std.traits
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Nov 27 09:26:39 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9065
--- Comment #41 from Manu <turkeyman at gmail.com> 2012-11-27 09:26:36 PST ---
(In reply to comment #37)
> This is a compiler bug, not an issue of isFunction template.
> I filed new bug 9083.
I found another one, probably a compiler bug too, but I'll paste it here since
it depends on your new isVariable trait:
Boiled down as much as I could...
class Test
{
void func()
{
void templateFunc( T )( ref const T obj )
{
foreach( m; __traits( allMembers, T ) )
{
pragma(msg, m);
static if( isVariable!( __traits(getMember, T, m) ) )
{
//...
}
}
}
templateFunc( this );
}
// some class members
int x;
}
isVariable throws lots of errors when considering the class members.
Note:
__traits(allMembers, T) and __traits(getMember, T, m)
These should also work with class instances, not just types, eg:
__traits(allMembers, obj) and __traits(getMember, obj, m)
And these combinations should also work:
__traits(allMembers, T) and __traits(getMember, obj, m)
__traits(allMembers, obj) and __traits(getMember, T, m)
All these configurations throw errors, and the errors are different for each
configuration.
--
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