digitalmars.D.bugs - [Issue 8388] New: std.traits.MemberFunctionsTuple doesn't work with constructors or destructors
- d-bugmail puremagic.com (43/43) Jul 13 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8388
- d-bugmail puremagic.com (24/24) Jul 13 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8388
http://d.puremagic.com/issues/show_bug.cgi?id=8388 Summary: std.traits.MemberFunctionsTuple doesn't work with constructors or destructors Product: D Version: unspecified Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: jmdavisProg gmx.com --- Comment #0 from Jonathan M Davis <jmdavisProg gmx.com> 2012-07-13 22:52:08 PDT --- This code import std.stdio; import std.traits; class C { this() {} this(int i) {} this(int i, float j) {} this(string s) {} ~this() {} } void main() { writeln(__traits(hasMember, C, "__ctor")); writeln(__traits(hasMember, C, "__dtor")); foreach(f; MemberFunctionsTuple!(C, "__ctor")) writeln(f.stringof); foreach(f; MemberFunctionsTuple!(C, "__dtor")) writeln(f.stringof); } prints true true The MemberFunctionsTuple results are empty. The constructors and destructor should be listed, but none are. So, clearly, while hasMember properly finds the constructors and destructor, MemberFunctionsTuple does not. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 13 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8388 --- Comment #1 from Jonathan M Davis <jmdavisProg gmx.com> 2012-07-13 23:33:57 PDT --- It looks like MermberFunctionsTuple only grabs virtual functions. This code import std.stdio; import std.traits; class C { void foo()() {} void goo() { foo(); } } void main() { foreach(f; MemberFunctionsTuple!(C, "foo")) writeln(f.stringof); foreach(f; MemberFunctionsTuple!(C, "goo")) writeln(f.stringof); } just prints goo() foo() isn't printed. So, the constructors and destructor probably aren't being grabbed, because they're non-virtual. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 13 2012