On 2016-01-13 04:32, Shriramana Sharma wrote:
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?

Mixed in functions are in a different overload set from the context where they're mixed in [1].

[1] http://dlang.org/spec/template-mixin.html - search for "Alias declarations can be used to overload together functions declared in different mixins"

--
/Jacob Carlborg

Reply via email to