www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18025] New: ICE with __traits(compiles)

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

          Issue ID: 18025
           Summary: ICE with __traits(compiles)
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: erikas.aubade gmail.com

This testcase causes an ICE for me on every version of DMD since 2.073.0 on
both Windows and Linux

class A {
        B!string[2] names() {
                return [null, null];
        };
}

class B(T, size_t idx = 0) {
}

class C {
}

template Testing(T) {
        private B!string[] var;
        static if (__traits(compiles, var = T.init.names)) {
                enum Testing = true;
        } else {
                enum Testing = false;
        }
}

void main() {
        assert (Testing!A);
        assert (!Testing!C);
}

--
Dec 02