mixed-in ctor not on par with explicit one?

Shriramana Sharma via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jan 12 19:32:12 PST 2016


Hello. Compiling the following code:

mixin template intCtor() { this(int i) {} }
struct Test { mixin intCtor; this(string s) {} }
void main()
{
    auto a = Test("hello");
    auto b = Test(1);
}

...gives the error:

<src>(6): Error: constructor <src>.Test.this (string s) is not callable 
using argument types (int)

What is the problem in calling the mixed-in ctor?

-- 
Shriramana Sharma, Penguin #395953


More information about the Digitalmars-d-learn mailing list