digitalmars.D.bugs - [Issue 5988] New: Error when template is instantiated in a class
- d-bugmail puremagic.com (40/40) May 12 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5988
- d-bugmail puremagic.com (14/14) May 12 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5988
- d-bugmail puremagic.com (22/22) May 12 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5988
- d-bugmail puremagic.com (26/43) Feb 09 2013 http://d.puremagic.com/issues/show_bug.cgi?id=5988
- d-bugmail puremagic.com (10/28) Feb 09 2013 http://d.puremagic.com/issues/show_bug.cgi?id=5988
- d-bugmail puremagic.com (18/36) May 18 2013 http://d.puremagic.com/issues/show_bug.cgi?id=5988
- d-bugmail puremagic.com (11/11) May 18 2013 http://d.puremagic.com/issues/show_bug.cgi?id=5988
- d-bugmail puremagic.com (13/13) Jun 25 2013 http://d.puremagic.com/issues/show_bug.cgi?id=5988
- d-bugmail puremagic.com (10/10) Jun 25 2013 http://d.puremagic.com/issues/show_bug.cgi?id=5988
http://d.puremagic.com/issues/show_bug.cgi?id=5988 Summary: Error when template is instantiated in a class Product: D Version: D2 Platform: Other OS/Version: Mac OS X Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: robert octarineparrot.com 18:43:25 BST --- The following code: ---- template Templ(alias T) { alias T!int Templ; } class C(T) { Templ!C foo; } // Uncomment this to make the error go away //Templ!C foo; void main() { C!int a; } ---- Gives the error: ---- test.d(3): Error: template instance T is not a template declaration, it is a class ---- When uncommenting the line mentioned in the code the error goes away, presumably because the forward reference goes away. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 12 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5988 20:19:19 BST --- This issue can be worked around using: ---- alias C Workaround; class C(T) { Templ!Workaround foo; } ---- This shouldn't be needed though. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 12 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5988 kennytm gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kennytm gmail.com This is because that class template is actually template C(T) { class C { <declarations> } } so the C inside is referring to the class C, not the template C. This code works: class C(T) { Templ!(.C) foo; } I don't know why uncomment the global instantiation makes the problem goes away. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 12 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5988 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|rejects-valid |accepts-invalid CC| |andrej.mitrovich gmail.com OS/Version|Mac OS X |All 06:06:21 PST ---This is because that class template is actually template C(T) { class C { <declarations> } } so the C inside is referring to the class C, not the template C. This code works: class C(T) { Templ!(.C) foo; } I don't know why uncomment the global instantiation makes the problem goes away.Yeah, this is an accepts-invalid for this test-case: template Templ(alias T) { alias T!int Templ; } class C(T) { Templ!(C) foo; // should be NG, must use Templ!(.C) } Templ!C foo; void main() { C!int a; } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 09 2013
http://d.puremagic.com/issues/show_bug.cgi?id=5988 06:08:43 PST ---Yeah, this is an accepts-invalid for this test-case: template Templ(alias T) { alias T!int Templ; } class C(T) { Templ!(C) foo; // should be NG, must use Templ!(.C) } Templ!C foo; void main() { C!int a; }I think the cause could perhaps be a mangling issue or the way the compiler searches for template instances. It finds a 'Templ!C' and decides to use that instead of instantiating a new 'Templ!C', where 'C' is something completely different. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 09 2013
http://d.puremagic.com/issues/show_bug.cgi?id=5988Yeah, this is an accepts-invalid for this test-case: template Templ(alias T) { alias T!int Templ; } class C(T) { Templ!(C) foo; // should be NG, must use Templ!(.C) } Templ!C foo; void main() { C!int a; }No. This is rejects-valid issue. Templ!(C) would capture class C (not template C), BUT, inside Templ, T!int should be translated to the instantiation of template C. The behavior is consistent with the following: class C(T) { void foo() { C!long c; // here 'C' points class (not template), but C!long will // automatically translated to the template C instantiation. } } C!int c; -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 18 2013
http://d.puremagic.com/issues/show_bug.cgi?id=5988 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|accepts-invalid |pull, rejects-valid Platform|Other |All https://github.com/D-Programming-Language/dmd/pull/2051 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 18 2013
http://d.puremagic.com/issues/show_bug.cgi?id=5988 Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/d683a052674722d5320a6de44cf2f7456e80b8f7 fix Issue 5988 - Template accepts instantiating an already-instantiated template type https://github.com/D-Programming-Language/dmd/commit/771c99c6ccf34032a8cc43f5462caa9e3457630e Issue 5988 - Template accepts instantiating an already-instantiated template type -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 25 2013
http://d.puremagic.com/issues/show_bug.cgi?id=5988 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla digitalmars.com Resolution| |FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 25 2013