[Issue 16468] New: __traits(compiles, ...) doesn't work for super, always evaluates false
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Sep 5 08:04:19 PDT 2016
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: nobody at puremagic.com
Reporter: meapineapple at gmail.com
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);
}
--
More information about the Digitalmars-d-bugs
mailing list