Bug 2823 – -w switch breaks CTFE

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2009-04-09T07:34:00Z
Last change time
2015-06-09T01:18:02Z
Keywords
rejects-valid
Assigned to
nobody
Creator
dfj1esp02

Comments

Comment #0 by dfj1esp02 — 2009-04-09T07:34:56Z
--- module Test; import std.stdio; int main() { writeln("should not be -1: ",a(-1)); return 0; } short a(short b) pure nothrow { return b>>>1; } static assert(a(-1)==-1); --- >\dev\dmd\bin\dmd tmp.d -I.. -oftmp.exe -w warning - tmp.d(32): Error: implicit conversion of expression (cast(int)b >>> 1) of type int to short can cause loss of data tmp.d(43): Error: cannot evaluate a(cast(short)-1) at compile time tmp.d(43): Error: static assert (cast(int)a(cast(short)-1) == -1) is not evaluatable at compile time >tmp 'tmp' is not recognized as an internal or external command, operable program or batch file. >\dev\dmd\bin\dmd tmp.d -I.. -oftmp.exe c:\dev\d\win>tmp should not be -1: -1
Comment #1 by clugdbug — 2009-07-10T08:00:53Z
In DMD2.031, CTFE and -w no longer makes any difference to the behaviour: it now _always_ generates an error.