digitalmars.D.bugs - [Issue 7809] New: __traits(getMember can be used with a type although the spec says it cannot
- d-bugmail puremagic.com (24/24) Apr 02 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7809
- d-bugmail puremagic.com (25/25) Jan 08 2013 http://d.puremagic.com/issues/show_bug.cgi?id=7809
http://d.puremagic.com/issues/show_bug.cgi?id=7809 Summary: __traits(getMember can be used with a type although the spec says it cannot Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: websites AssignedTo: nobody puremagic.com ReportedBy: simendsjo gmail.com struct S { int i; } is( typeof(__traits(getMember, S, "i")) == int ) // works The spec, on the other hand, says it cannot be used on non-static fields. That's my interpretation. http://dlang.org/traits.html#getMember -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 02 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7809 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |andrej.mitrovich gmail.com Resolution| |INVALID 12:52:23 PST --- No, the error is in the assignment: struct S { int i; } void main() { __traits(getMember, S, "i") = 1; } Error: need 'this' to access member i The trait docs specifically state that all the trait does is forms an expression. But I don't think we even need it anymore since we can use string mixins, although it has to be around for backwards-compatibility. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 08 2013