digitalmars.D.bugs - [Issue 6910] New: __traits(hasMember, "<name>") does not work, if template has alias param
- d-bugmail puremagic.com (59/59) Nov 08 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6910
- d-bugmail puremagic.com (15/15) Nov 12 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6910
- d-bugmail puremagic.com (13/13) Nov 14 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6910
http://d.puremagic.com/issues/show_bug.cgi?id=6910 Summary: __traits(hasMember, "<name>") does not work, if template has alias param Product: D Version: D2 Platform: x86_64 OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: tobias pankrath.net --- Comment #0 from Tobias Pankrath <tobias pankrath.net> 2011-11-08 14:29:58 PST --- Given this code fragment: -------------- struct Bag(S...) { alias S Types; } template Test(alias i, B) { void fn() { foreach(t; B.Types) { switch(i) { case IndexOf!(t, B.Types): { pragma(msg, __traits(allMembers, t)); pragma(msg, __traits(hasMember, t, "m")); break; } default: {} } } } } struct A { int m; } void main() { int i; alias Test!(i, Bag!(A)).fn func; } ---------------------- DMD will output: ---------------------- tuple("m") false --------------------- It seems that __traits(hasMember, ..) evaluates to false, despite the fact that the type does have a member "m". However if the template Test does not have an alias parameter, everything will work just fine. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 08 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6910 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch, wrong-code Platform|x86_64 |All Version|D2 |D1 & D2 OS/Version|Linux |All --- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2011-11-12 08:43:48 PST --- I think this is an issue that both of D1 and D2 have. D2 patch: https://github.com/D-Programming-Language/dmd/pull/509 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 12 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6910 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla digitalmars.com Resolution| |FIXED --- Comment #2 from Walter Bright <bugzilla digitalmars.com> 2011-11-14 00:33:46 PST --- https://github.com/D-Programming-Language/dmd/commit/6fb5861528c7568d2546774a1c884f99594024c0 https://github.com/D-Programming-Language/dmd/commit/129c1ae7fe50cb3cb9a218e232f42f9a5a987e29 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 14 2011