[Issue 17872] New: 'lazy' on variadic template parameters is ignored
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Oct 2 06:55:08 UTC 2017
https://issues.dlang.org/show_bug.cgi?id=17872
Issue ID: 17872
Summary: 'lazy' on variadic template parameters is ignored
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: simen.kjaras at gmail.com
This assert fails:
void foo(T...)(lazy T args) {}
unittest {
int n = 3;
foo(n++);
assert(n == 3); // Fails, n == 4.
}
This means there is no way to mark an arbitrary number of arguments of unknown
types as lazy. A workaround exists for limited numbers, where (T1, T2, T3) is
used in place of T..., but this solution does not scale.
--
More information about the Digitalmars-d-bugs
mailing list