www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20776] New: No error is given out for wrong static if

https://issues.dlang.org/show_bug.cgi?id=20776

          Issue ID: 20776
           Summary: No error is given out for wrong static if expression
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: critical
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: bitworld qq.com

No any error is given out while compiling when a undefined function used in
static if


Here is the test code:

import std.stdio;
// import std.traits; // Forgot to import this, then no error is given out
while compiling

void test(T)() {

    static if(is(T : K[], K) && is(Unqual!K == ubyte)) {
        writeln("OK");
    } else {
        writeln("Wrong");
    }
}

void main() {
    test!(const(ubyte)[]);
}

--
Apr 26