www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 992] New: CTFE Failure with static if

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

           Summary: CTFE Failure with static if
           Product: D
           Version: 1.006
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: webmaster villagersonline.com


The following code fails with dmd.1.006:
  bool isWhitespace(char c) {
    return true;
  }
  static if(isWhitespace('c'))
    int x;

with the messages
  foo.d(4): Error: expression (isWhitespace)('c') is not constant or does not
evaluate to a bool


-- 
Feb 21 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=992


webmaster villagersonline.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED





Looks like this was fixed in 1.007.


-- 
Feb 22 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=992


webmaster villagersonline.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |





Looks like static assert() now has this problem in dmd.1.007.  That is, change
static if() in the example code to static assert() and we get the same problem.


-- 
Feb 23 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=992






Added to DStress as
http://dstress.kuehne.cn/compile/a/assert_20_A.d
http://dstress.kuehne.cn/compile/a/assert_20_B.d
http://dstress.kuehen.cn/run/s/static_if_08_A.d
http://dstress.kuehen.cn/run/s/static_if_08_B.d


-- 
Feb 26 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=992






Please create new bug reports rather than reopen closed one for new situations.


-- 
Mar 08 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=992


webmaster villagersonline.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED





Fixed in 1.009.


-- 
Mar 11 2007