Skip to content

Commit

Permalink
fix Issue 17492 - [REG 2.066] [ICE] AssertError@ddmd/dclass.d(1007): …
Browse files Browse the repository at this point in the history
…Assertion failure
  • Loading branch information
WalterBright committed Jul 3, 2017
1 parent ea2033f commit 573d877
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/ddmd/dclass.d
Original file line number Diff line number Diff line change
Expand Up @@ -967,6 +967,18 @@ extern (C++) class ClassDeclaration : AggregateDeclaration

sc2.pop();

if (type.ty == Tclass && (cast(TypeClass)type).sym != this)
{
// https://issues.dlang.org/show_bug.cgi?id=17492
ClassDeclaration cd = (cast(TypeClass)type).sym;
version (none)
{
printf("this = %p %s\n", this, this.toPrettyChars());
printf("type = %d sym = %p, %s\n", type.ty, cd, cd.toPrettyChars());
}
error("already exists at %s. Perhaps in another function with the same name?", cd.loc.toChars());
}

if (global.errors != errors)
{
// The type is no good.
Expand Down Expand Up @@ -995,16 +1007,6 @@ extern (C++) class ClassDeclaration : AggregateDeclaration
deferred.semantic2(sc);
deferred.semantic3(sc);
}

version (none)
{
if (type.ty == Tclass && (cast(TypeClass)type).sym != this)
{
printf("this = %p %s\n", this, this.toChars());
printf("type = %d sym = %p\n", type.ty, (cast(TypeClass)type).sym);
}
}
assert(type.ty != Tclass || (cast(TypeClass)type).sym == this);
//printf("-ClassDeclaration.semantic(%s), type = %p, sizeok = %d, this = %p\n", toChars(), type, sizeok, this);
}

Expand Down

0 comments on commit 573d877

Please sign in to comment.