digitalmars.D.bugs - [Issue 1225] New: Super Class method hides the global template from mixin
- d-bugmail puremagic.com (43/43) May 09 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1225
- d-bugmail puremagic.com (45/45) Sep 15 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1225
- d-bugmail puremagic.com (4/4) Sep 23 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1225
http://d.puremagic.com/issues/show_bug.cgi?id=1225 Summary: Super Class method hides the global template from mixin Product: D Version: 1.014 Platform: PC OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: davidl 126.com import std.stdio; template dup(T){ T dup(){ auto c=new T; foreach(i,x;T.tupleof) { c.tupleof[i]=x; writefln(`tupleof `,i); } return c; } } class baseclass { mixin dup!(baseclass); void method(){printf("a.method\n");} } class deriveclass:baseclass { mixin dup!(deriveclass); int j; void method(){printf("b.method\n");} } void main() { deriveclass mybinstance = new deriveclass; mybinstance.dup; } compiler complains: testclass.d(21): mixin dup isn't a template --
May 09 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1225 davidl 126.com changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Super Class method hides the|Super Class method hides the |global template from mixin |global template from mixin ------- Comment #1 from davidl 126.com 2007-09-15 09:22 ------- This illustrate the bug a little more clearly, and also fix some issues of the original code. import std.stdio; template dup(T){ T dup(){ auto c=new T; foreach(i,x;this.tupleof) { c.tupleof[i]=x; writefln(`tupleof `,x); } return c; } } class baseclass { // mixin dup!(baseclass); // comment this , the dup won't be hidden anymore in the derive class void method(){printf("a.method\n");} } class deriveclass:baseclass { mixin dup!(deriveclass); int j; float i; void method(){printf("b.method\n");} this() { i=34; j=10; } } void main() { deriveclass mybinstance = new deriveclass; mybinstance.dup(); } --
Sep 15 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1225 ------- Comment #2 from davidl 126.com 2007-09-23 03:27 ------- *** Bug 1527 has been marked as a duplicate of this bug. *** --
Sep 23 2007