www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2823] New: -w switch breaks CTFE

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2823

           Summary: -w switch breaks CTFE
           Product: D
           Version: 2.027
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: maxmo pochta.ru


---
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

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

operable program or batch file.
\dev\dmd\bin\dmd tmp.d -I.. -oftmp.exe

c:\dev\d\win>tmp should not be -1: -1 --
Apr 09 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2823


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug yahoo.com.au
         Resolution|                            |FIXED




--- Comment #1 from Don <clugdbug yahoo.com.au>  2009-07-10 08:00:53 PDT ---
In DMD2.031, CTFE and -w no longer makes any difference to the behaviour: it
now _always_ generates an error.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 10 2009