Skip to content

Commit

Permalink
fix issue 10721 - ICE with constructor with postcondition
Browse files Browse the repository at this point in the history
  • Loading branch information
hpohl committed Jul 27, 2013
1 parent 6619191 commit 810ba19
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/func.c
Original file line number Diff line number Diff line change
Expand Up @@ -1475,7 +1475,7 @@ void FuncDeclaration::semantic3(Scope *sc)

// BUG: need to treat parameters as const
// BUG: need to disallow returns and throws
if (inferRetType && isMember() && ((TypeFunction *)fdensure->type)->parameters)
if (inferRetType && fdensure && ((TypeFunction *)fdensure->type)->parameters)
{
// Return type was unknown in the first semantic pass
Parameter *p = (*((TypeFunction *)fdensure->type)->parameters)[0];
Expand Down
21 changes: 21 additions & 0 deletions test/runnable/testcontracts.d
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,27 @@ class Foo10596
body { return 0; }
}

/*******************************************/
// 10721

class Foo10721
{
this()
out { }
body { }

~this()
out { }
body { }
}

struct Bar10721
{
this(this)
out { }
body { }
}

/*******************************************/

int main()
Expand Down

0 comments on commit 810ba19

Please sign in to comment.