digitalmars.D.bugs - [Issue 6613] New: Can't use empty tuple as default value for variadic template function parameter
- d-bugmail puremagic.com (26/26) Sep 06 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6613
- d-bugmail puremagic.com (19/19) Feb 08 2013 http://d.puremagic.com/issues/show_bug.cgi?id=6613
http://d.puremagic.com/issues/show_bug.cgi?id=6613 Summary: Can't use empty tuple as default value for variadic template function parameter Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: minor Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: thecybershadow gmail.com --- Comment #0 from Vladimir Panteleev <thecybershadow gmail.com> 2011-09-06 12:40:19 PDT --- template Tuple(T...) { alias T Tuple; } void f(T...)(int arg0 = 0, T argN = Tuple!()); static this() { f(); } Compiler output: test.d(3): Error: cannot implicitly convert expression (tuple()) of type () to () test.d(5): Error: template instance test.f!() error instantiating The compiler requires a default value for argN, because it comes after another optional argument, but it doesn't seem like an empty tuple can be specified. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 06 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6613 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrej.mitrovich gmail.com, | |k.hara.pg gmail.com --- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-02-08 18:01:40 PST --- [internal note]: It seems Tuple!() is treated as a type when it's a default argument (at least ExpInitializer::semantic seems to think so). But as a variable initializer it works ok: template Tuple(T...) { alias T Tuple; } void main() { Tuple!() t = Tuple!(); } CC'ing Kenji since he might be interested in this bug. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 08 2013