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);
}
Comment #1 by meapineapple — 2016-09-05T15:07:07Z
I thought to use typeof({super(x);}) as a workaround but this generates a compilation error "Super class constructor call must be in a constructor"
Comment #2 by meapineapple — 2016-09-05T15:08:44Z
Oh, that second error illuminated the first. I was able to get the pragma to output the correct flag by rewriting as `pragma(msg, __traits(compiles, super(x)));` but now I'm just hitting the same error as here https://issues.dlang.org/show_bug.cgi?id=15428
Comment #3 by bitter.taste — 2017-01-17T15:36:06Z
*** This issue has been marked as a duplicate of issue 15428 ***