Bug 11196 – `std.range.zip` fails to compile if range elements aren't default contructable
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-10-08T06:07:00Z
Last change time
2013-10-19T02:39:54Z
Keywords
rejects-valid
Assigned to
verylonglogin.reg
Creator
verylonglogin.reg
Comments
Comment #0 by verylonglogin.reg — 2013-10-08T06:07:04Z
Insted it should throw if range with non default contructable elements is exhausted:
---
import std.exception, std.range;
void main()
{
static struct S { @disable this(); }
static assert(__traits(compiles, zip((S[5]).init[]))); // assert fails
// This is assumed to compile and pass:
assertThrown(zip(StoppingPolicy.longest, cast(S[]) null, new int[1]).front);
}
---
Comment #1 by verylonglogin.reg — 2013-10-08T06:09:22Z