digitalmars.D.bugs - [Issue 1012] New: type templates don't support default arguments
- d-bugmail puremagic.com (26/26) Feb 28 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1012
- Don Clugston (6/37) Mar 01 2007 Are you allowed to leave out the !() in class template instantations?
- Sean Kelly (4/5) Mar 01 2007 No, but I think you perhaps should be allowed. I posted as much here
- d-bugmail puremagic.com (13/13) Jun 29 2009 http://d.puremagic.com/issues/show_bug.cgi?id=1012
- d-bugmail puremagic.com (12/12) Sep 30 2009 http://d.puremagic.com/issues/show_bug.cgi?id=1012
- d-bugmail puremagic.com (10/10) Sep 26 2012 http://d.puremagic.com/issues/show_bug.cgi?id=1012
- d-bugmail puremagic.com (11/11) Nov 16 2012 http://d.puremagic.com/issues/show_bug.cgi?id=1012
- d-bugmail puremagic.com (13/13) Nov 16 2012 http://d.puremagic.com/issues/show_bug.cgi?id=1012
- d-bugmail puremagic.com (18/19) Nov 16 2012 http://d.puremagic.com/issues/show_bug.cgi?id=1012
- d-bugmail puremagic.com (17/18) Nov 16 2012 http://d.puremagic.com/issues/show_bug.cgi?id=1012
http://d.puremagic.com/issues/show_bug.cgi?id=1012 Summary: type templates don't support default arguments Product: D Version: 1.007 Platform: PC OS/Version: All Status: NEW Severity: normal Priority: P3 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: thomas-dloop kuehne.cn # class Bar(T = int){ # } # # void foo(T = int)(){ # } # # void main(){ # foo(); // success # auto b = new Bar(); // fails # } test.d(9): class test.Bar(T = int) is used as a type test.d(9): Error: new can only create structs, dynamic arrays or class objects, not void's --
Feb 28 2007
d-bugmail puremagic.com wrote:http://d.puremagic.com/issues/show_bug.cgi?id=1012 Summary: type templates don't support default arguments Product: D Version: 1.007 Platform: PC OS/Version: All Status: NEW Severity: normal Priority: P3 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: thomas-dloop kuehne.cn # class Bar(T = int){ # } # # void foo(T = int)(){ # } # # void main(){ # foo(); // success # auto b = new Bar(); // fails # } test.d(9): class test.Bar(T = int) is used as a type test.d(9): Error: new can only create structs, dynamic arrays or class objects, not void'sAre you allowed to leave out the !() in class template instantations? I'd expect to have to write auto b = new Bar!()(); or at least auto b = new Bar!();
Mar 01 2007
Don Clugston wrote:Are you allowed to leave out the !() in class template instantations?No, but I think you perhaps should be allowed. I posted as much here asking for comments, but the thread got no replies: http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D&artnum=48672
Mar 01 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1012 Stewart Gordon <smjg iname.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |enhancement --- Comment #3 from Stewart Gordon <smjg iname.com> 2009-06-29 02:04:23 PDT --- AIUI this isn't supposed to work. If we allowed such implicit template instantiation everywhere, it would create ambiguities (alias declarations come to mind). That's why, at the moment, it's explicitly allowed in some contexts where it's unambiguous, such as IFTI and (to some degree) mixins. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 29 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1012 --- Comment #4 from Rainer Schuetze <r.sagitario gmx.de> 2009-09-30 14:48:47 PDT --- Created an attachment (id=466) convert TypeIdentifer refering to TemplateDeclaration to TypeInstance I don't expect any additional ambiguities, because the template types are in the same namespace as all other identifers anyway (apart from version and debug identifiers). This patch against 2.032 converts a TypeIdentifier (as created by the parser) into a TypeInstance if name lookup revealed that it is actually a template. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 30 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1012 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |leo.dahlmann gmail.com --- Comment #5 from Don <clugdbug yahoo.com.au> 2012-09-26 00:51:01 PDT --- *** Issue 1328 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 26 2012
http://d.puremagic.com/issues/show_bug.cgi?id=1012 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull --- Comment #6 from Kenji Hara <k.hara.pg gmail.com> 2012-11-16 01:22:06 PST --- D2 pull: https://github.com/D-Programming-Language/dmd/pull/1295 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 16 2012
http://d.puremagic.com/issues/show_bug.cgi?id=1012 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla digitalmars.com --- Comment #7 from Walter Bright <bugzilla digitalmars.com> 2012-11-16 10:39:26 PST --- I have severe misgivings about this. C has had problems with implicitly taking the address of a function. D has had a number of problems with implicitly calling a function (the property thing). It's just ambiguous in many cases, and leads to trouble, trouble, trouble. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 16 2012
http://d.puremagic.com/issues/show_bug.cgi?id=1012 Jonathan M Davis <jmdavisProg gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jmdavisProg gmx.com --- Comment #8 from Jonathan M Davis <jmdavisProg gmx.com> 2012-11-16 10:58:46 PST ---I have severe misgivings about this.I concur. It seems like it just begging for trouble when providing minimal gain. Not to mention that it would harm code readability in many cases, which will therefore harm code maintainability. issue# 6082 might be reasonable to implement (I don't know), in which case the example here would compile, but that would be restricted specifically to constructors. Making it so that templates in general can be instantiated without !() if they don't need any arguments is a bad idea IHMO. And I think that this post on the newsgroup is a good example of why this is a bad idea: http://forum.dlang.org/post/vmipipnhyiilketbygbw forum.dlang.org -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 16 2012
http://d.puremagic.com/issues/show_bug.cgi?id=1012 Jakob Ovrum <jakobovrum gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakobovrum gmail.com --- Comment #9 from Jakob Ovrum <jakobovrum gmail.com> 2012-11-16 11:14:54 PST --- (In reply to comment #8)issue# 6082 might be reasonable to implement (I don't know),It's not possible in the general case. http://stackoverflow.com/questions/13151072/ It might still be an attractive feature to have for specific, common cases, but it would either have to be defined as a "compiler's best effort" thing, which hurts portability, or defined to only work for a select few specific cases. The latter is what's currently done for IFTI, but the rules are intuitive, especially thanks to eponymous templates. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 16 2012