mixed in struct constructor is ignored when another (non mixed in) constructor is specified
ParticlePeter
ParticlePeter at gmx.de
Mon Feb 26 12:30:24 UTC 2018
mixin template Common() {
private int m_member;
this( int m ) { m_member = m; }
}
struct Foo {
mixin Common;
}
struct Bar {
mixin Common;
this( int m, float n ) { m_member = m * n; }
}
auto foo = Foo(1); // ok
auto b_1 = Bar( 1, 2 ); // ok
auto b_2 = Bar( 3 ); // Error: constructor main.Bar.this (int
m, int n) is not callable using argument types (int)
Is this expected behavior?
More information about the Digitalmars-d-learn
mailing list