digitalmars.D.bugs - [Issue 2359] New: typeof(this) gives the wrong type in template mixins
- d-bugmail puremagic.com (45/45) Sep 14 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2359
- mpt (3/61) Sep 14 2008 Use extra parenthesis as a workaround:
- d-bugmail puremagic.com (5/5) Jan 16 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2359
- d-bugmail puremagic.com (12/12) Sep 04 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2359
http://d.puremagic.com/issues/show_bug.cgi?id=2359 Summary: typeof(this) gives the wrong type in template mixins Product: D Version: 1.035 Platform: PC OS/Version: Windows Status: NEW Keywords: wrong-code Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: leo.dahlmann gmail.com Code: --------------- extern(C) int printf(char*, ...); class A { mixin Mix; } class B { mixin Mix; } template Mix() { void foo() { printf("%.*s\n", typeof(this).classinfo.name); } } void main() { (new A).foo(); (new B).foo(); } --------------- Output with any dmd since 1.032: main.A main.A This shows that typeof(this) in B.foo returns A. With dmd 1.031 the (imo correct) output is: main.A main.B --
Sep 14 2008
d-bugmail puremagic.com wrote:http://d.puremagic.com/issues/show_bug.cgi?id=2359 Summary: typeof(this) gives the wrong type in template mixins Product: D Version: 1.035 Platform: PC OS/Version: Windows Status: NEW Keywords: wrong-code Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: leo.dahlmann gmail.com Code: --------------- extern(C) int printf(char*, ...); class A { mixin Mix; } class B { mixin Mix; } template Mix() { void foo() { printf("%.*s\n", typeof(this).classinfo.name); } } void main() { (new A).foo(); (new B).foo(); } --------------- Output with any dmd since 1.032: main.A main.A This shows that typeof(this) in B.foo returns A. With dmd 1.031 the (imo correct) output is: main.A main.BUse extra parenthesis as a workaround: (typeof(this))
Sep 14 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2359 Appears to be fixed with DMD 1.039, probably related to http://d.puremagic.com/issues/show_bug.cgi?id=2527 --
Jan 16 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2359 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |clugdbug yahoo.com.au Resolution| |FIXED This works now. Clearly the same as bug 2527. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 04 2009