Classes and @disable this()

fra via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Feb 8 08:28:20 PST 2015


On Sunday, 8 February 2015 at 16:22:36 UTC, fra wrote:
Missclick... Anywya:
class Something
{
    @disable this();
    this(int i) {}
}

produces an undefined reference error.

I guess it has to do with classes implicitly inheriting from 
Object, and Object defining a this(), and @disable telling the 
compiler not to produce code for the given function.

However making it a compiler error would be far, far better then 
getting the linker error. In my case, the mangled name was 100% 
unintelligible (the usual "_ctor" was nowhere to be found, 
probably due to the class name being so long that it was getting 
shortened in some way)


More information about the Digitalmars-d-learn mailing list