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

          Issue ID: 16468
           Summary: __traits(compiles, ...) doesn't work for super, always
                    evaluates false
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: [email protected]
          Reporter: [email protected]

It seems that __traits cannot be used to check correctness of a super ctor
call, instead always returns false.

class Base{
    this(int x){}
}
class Sub: Base{
    this(int x){
        pragma(msg, __traits(compiles, {super(x);})); // false
        super(x); // yet compiles
    }
}
void main(){
    new Sub(10);
}

--

Reply via email to