digitalmars.D.bugs - [Issue 8238] New: regression: templates can create ghost fields
- d-bugmail puremagic.com (27/27) Jun 14 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8238
- d-bugmail puremagic.com (29/41) Jul 18 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8238
- d-bugmail puremagic.com (10/10) Jul 18 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8238
- d-bugmail puremagic.com (11/11) Feb 18 2013 http://d.puremagic.com/issues/show_bug.cgi?id=8238
- d-bugmail puremagic.com (9/9) Feb 18 2013 http://d.puremagic.com/issues/show_bug.cgi?id=8238
http://d.puremagic.com/issues/show_bug.cgi?id=8238 Summary: regression: templates can create ghost fields Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: accepts-invalid Severity: regression Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: timon.gehr gmx.ch DMD 2.059: struct S{ template t(){ int t; } } void main(){ S s,t; writeln(t.t!()); // 0 s.t!()=256; writeln(t.t!()," ",s.t!()); // 1 256 } The code is illegal, but accepted. I remember that such code used to be rejected. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 14 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8238 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|accepts-invalid |wrong-code Severity|regression |major The code is not illegal, but generates wrong code. See "Limitations" in http://dlang.org/template .Templates cannot be used to add non-static members or virtual functions to classes. For example: class Foo { template TBar(T) { T xx; // becomes a static member of Foo int func(T) { ... } // non-virtual static T yy; // Ok static int func(T t, int y) { ... } // Ok } }In this case, variable t in template t should become static member of struct S. Therefore following test case should pass, but fails with assertions. extern(C) int printf(const char*, ...); struct S{ template t(){ int t; } } void main(){ S s1, s2; printf("%p %p\n", &s1, &s1.t!()); printf("%p %p\n", &s2, &s2.t!()); assert(cast(void*)&s1 != cast(void*)&s2 ); assert(cast(void*)&s1 != cast(void*)&s1.t!()); // fails assert(cast(void*)&s2 != cast(void*)&s2.t!()); // fails assert(cast(void*)&s1.t!() == cast(void*)&s2.t!()); // fails s1.t!() = 256; assert(s2.t!() == 256); // fails } I couldn't find the dmd version "used to be rejected". But for the above reasons, This is not a regression, but just a wrong-code bug. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 18 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8238 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull https://github.com/D-Programming-Language/dmd/pull/1054 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 18 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8238 Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/b7f3f45b62541099bbff5e263a4da6f2b00c9023 fix Issue 8238 - templates can create ghost fields https://github.com/D-Programming-Language/dmd/commit/c20f46ca30b3a9ec8f4c3ab4e76397b0e691926f Issue 8238 - templates can create ghost fields -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 18 2013
http://d.puremagic.com/issues/show_bug.cgi?id=8238 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 18 2013