[Issue 8687] New: Variadic templates do not work properly with default arguments
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Sep 18 09:08:55 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8687
Summary: Variadic templates do not work properly with default
arguments
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: andrej.mitrovich at gmail.com
--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2012-09-18 09:09:36 PDT ---
A simplified version of std.range.lockstep:
auto newLockstep(Args...)(Args args, StoppingPolicy stoppingPolicy =
StoppingPolicy.shortest)
{
// ...
}
However it doesn't work:
foreach (x, y; newLockstep([1, 2], [1, 2])) { }
test.d(32): Error: template test.newLockstep does not match any
function template declaration
test.d(14): Error: template test.newLockstep(Args...) if
(allSatisfy!(isInputRange,staticMap!(Unqual,Args))) cannot deduce
template function from argument types !()(int[],int[])
Passing an argument in place of the default explicitly does work:
foreach (x, y; newLockstep([1, 2], [1, 2], StoppingPolicy.shortest)) { }
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list