Bug 17446 – Static-assert passes/fails based on what follows

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2017-05-27T12:03:12Z
Last change time
2022-11-18T15:24:59Z
Assigned to
No Owner
Creator
Dario Schiavon

Comments

Comment #0 by dario.schiavon — 2017-05-27T12:03:12Z
import std.traits : isAssignable; struct MyStruct { static assert(isAssignable!MyStruct); // fails, but passes if the following line is removed static if (isAssignable!MyStruct) {} } The assertion fails (wrongly IMO), but passes if the following static-if is removed. Using DMD32 v2.074.0 or LDC2 v1.1.1 (based on DMD v2.071.2). See also https://issues.dlang.org/show_bug.cgi?id=17445
Comment #1 by razvan.nitu1305 — 2022-11-18T15:24:59Z
I cannot reproduce this. The assert passes with and without the static if. Closing as WORKSFORME.