digitalmars.D.bugs - [Issue 15055] New: isArray!NonArray doesn't short-circuit an
- via Digitalmars-d-bugs (30/30) Sep 13 2015 https://issues.dlang.org/show_bug.cgi?id=15055
https://issues.dlang.org/show_bug.cgi?id=15055 Issue ID: 15055 Summary: isArray!NonArray doesn't short-circuit an expression Product: D Version: D2 Hardware: x86_64 OS: Mac OS X Status: NEW Severity: normal Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: foldenyi.tamas gmail.com I expect the following code run without an error: template sameUnqualArrays(A, B) { enum bool sameUnqualArrays = isArray!A && isArray!B && is(Unqual!(ForeachType!A) == Unqual!(ForeachType!B)); } unittest { static assert(sameUnqualArrays!(ubyte[], immutable(ubyte[]))); static assert(!sameUnqualArrays!(ubyte[], immutable(byte[]))); static assert(!sameUnqualArrays!(ubyte[], ubyte)); } But the last assert gives an error: /usr/include/dmd/phobos/std/traits.d(6062,9): Error: invalid foreach aggregate cast(ubyte)0u I expect that isArray short circuits the expression before the second half is evaluated. I am using DMD64 D Compiler v2.068.0 --
Sep 13 2015