Skip to content

Commit

Permalink
fix Issue 13311 - ICE, CtorDeclaration::semantic(Scope*): Assertion `…
Browse files Browse the repository at this point in the history
…tf && tf->ty == Tfunction' failed
  • Loading branch information
9rnsr committed Aug 26, 2014
1 parent 39d3dc6 commit 1ea0f02
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/func.c
Expand Up @@ -4313,9 +4313,6 @@ Dsymbol *CtorDeclaration::syntaxCopy(Dsymbol *s)
void CtorDeclaration::semantic(Scope *sc)
{
//printf("CtorDeclaration::semantic() %s\n", toChars());
TypeFunction *tf = (TypeFunction *)type;
assert(tf && tf->ty == Tfunction);

if (scope)
{
sc = scope;
Expand All @@ -4330,6 +4327,12 @@ void CtorDeclaration::semantic(Scope *sc)

sc->pop();

if (errors)
return;

TypeFunction *tf = (TypeFunction *)type;
assert(tf && tf->ty == Tfunction);

Dsymbol *parent = toParent2();
AggregateDeclaration *ad = parent->isAggregateDeclaration();

Expand All @@ -4343,7 +4346,8 @@ void CtorDeclaration::semantic(Scope *sc)
if (sd)
{
if (fbody || !(storage_class & STCdisable))
{ error("default constructor for structs only allowed with @disable and no body");
{
error("default constructor for structs only allowed with @disable and no body");
storage_class |= STCdisable;
fbody = NULL;
}
Expand Down
12 changes: 12 additions & 0 deletions test/fail_compilation/ice13311.d
@@ -0,0 +1,12 @@
/*
TEST_OUTPUT:
---
fail_compilation/imports/a13311.d(8): Error: undefined identifier PieceTree
---
*/
module ice13311;

struct TextPiece
{
import imports.a13311;
}
9 changes: 9 additions & 0 deletions test/fail_compilation/imports/a13311.d
@@ -0,0 +1,9 @@
module imports.a13311;

import ice13311;

class Z
{
TextPiece piece;
this(PieceTree owner) {}
}

0 comments on commit 1ea0f02

Please sign in to comment.