Bug 9851 – Mixed-in constructor is not taken into account during construction
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-03-31T15:07:00Z
Last change time
2013-08-21T15:26:31Z
Keywords
rejects-valid
Assigned to
nobody
Creator
andrej.mitrovich
Comments
Comment #0 by andrej.mitrovich — 2013-03-31T15:07:09Z
mixin template IntCtor()
{
this(int x)
{
}
}
struct S
{
mixin IntCtor!();
this(string x) { }
}
void main()
{
// Error: constructor test.S.this (string x) is not
// callable using argument types (int)
auto s = S(1);
}
Comment #1 by john.loughran.colvin — 2013-08-21T15:18:43Z
not a bug, but there's no way around it barring string mixins. The mixin constructs a scope and there is no overload resolution between it and the enclosing scope.
Comment #2 by andrej.mitrovich — 2013-08-21T15:26:31Z
*** This issue has been marked as a duplicate of issue 8228 ***