Skip to content

Commit

Permalink
Merge pull request #5515 from 9rnsr/fix15744
Browse files Browse the repository at this point in the history
[REG2.067] Issue 15744 - (SIGABRT) Error: overloadset t.Bar.__ctor is aliased to a function
  • Loading branch information
MartinNowak committed Mar 11, 2016
2 parents f1ee0d0 + 1b4eefa commit 7e1a1a8
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/expression.d
Original file line number Diff line number Diff line change
Expand Up @@ -9311,6 +9311,12 @@ public:
error("an earlier return statement skips constructor");
sc.callSuper |= CSXany_ctor | CSXsuper_ctor;
}
if (auto os = cd.baseClass.ctor.isOverloadSet())
{
// Workaround for bugzilla 15744
os.error(loc, "is aliased to a function");
return new ErrorExp();
}
tthis = cd.type.addMod(sc.func.type.mod);
f = resolveFuncCall(loc, sc, cd.baseClass.ctor, null, tthis, arguments, 0);
if (!f || f.errors)
Expand Down Expand Up @@ -9345,6 +9351,12 @@ public:
error("an earlier return statement skips constructor");
sc.callSuper |= CSXany_ctor | CSXthis_ctor;
}
if (auto os = cd.ctor.isOverloadSet())
{
// Workaround for bugzilla 15744
os.error(loc, "is aliased to a function");
return new ErrorExp();
}
tthis = cd.type.addMod(sc.func.type.mod);
f = resolveFuncCall(loc, sc, cd.ctor, null, tthis, arguments, 0);
if (!f || f.errors)
Expand Down
57 changes: 57 additions & 0 deletions test/fail_compilation/ice15744.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
TEST_OUTPUT:
---
fail_compilation/ice15744.d(17): Error: overloadset ice15744.S.__ctor is aliased to a function
fail_compilation/ice15744.d(53): Error: template instance ice15744.S.AddField!string.__ctor!(int) error instantiating
fail_compilation/ice15744.d(41): Error: overloadset ice15744.B.__ctor is aliased to a function
fail_compilation/ice15744.d(54): Error: template instance ice15744.C.__ctor!(string, int) error instantiating
---
*/

template AddField(T)
{
T b;
this(Args...)(T b, auto ref Args args)
{
this.b = b;
this(args);
}
}

template construcotrs()
{
int a;
this(int a)
{
this.a = a;
}
}

class B
{
mixin construcotrs;
mixin AddField!(string);
}

class C : B
{
this(A...)(A args)
{
// The called super ctor is an overload set.
super(args);
}
}

struct S
{
mixin construcotrs;
mixin AddField!(string);
}

void main()
{
auto s = S("bar", 15);
auto c = new C("bar", 15);
}

// Note: This test case should be accepted finally. See issue 15784.

0 comments on commit 7e1a1a8

Please sign in to comment.