Skip to content

Commit

Permalink
Merge pull request #4678 from WalterBright/fix14610
Browse files Browse the repository at this point in the history
fix Issue 14610 - [REG2.067] 'null this' assertion missing in 2.067
  • Loading branch information
9rnsr committed May 30, 2015
2 parents 4c2a6d5 + fb10be8 commit 7dd1d17
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/func.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include "rmem.h"
#include "visitor.h"

Expression *addInvariant(Scope *sc, AggregateDeclaration *ad, VarDeclaration *vthis, bool direct);
Expression *addInvariant(Loc loc, Scope *sc, AggregateDeclaration *ad, VarDeclaration *vthis, bool direct);

void genCmain(Scope *sc);

Expand Down Expand Up @@ -1468,7 +1468,7 @@ void FuncDeclaration::semantic3(Scope *sc)
Statement *fpreinv = NULL;
if (addPreInvariant())
{
Expression *e = addInvariant(sc, ad, vthis, isDtorDeclaration() != NULL);
Expression *e = addInvariant(loc, sc, ad, vthis, isDtorDeclaration() != NULL);
if (e)
fpreinv = new ExpStatement(Loc(), e);
}
Expand All @@ -1477,7 +1477,7 @@ void FuncDeclaration::semantic3(Scope *sc)
Statement *fpostinv = NULL;
if (addPostInvariant())
{
Expression *e = addInvariant(sc, ad, vthis, isCtorDeclaration() != NULL);
Expression *e = addInvariant(loc, sc, ad, vthis, isCtorDeclaration() != NULL);
if (e)
fpostinv = new ExpStatement(Loc(), e);
}
Expand Down Expand Up @@ -3993,8 +3993,10 @@ bool FuncDeclaration::addPostInvariant()
* ad aggregate with the invariant
* vthis variable with 'this'
* direct call invariant directly
* Returns:
* void expression that calls the invariant
*/
Expression *addInvariant(Scope *sc, AggregateDeclaration *ad, VarDeclaration *vthis, bool direct)
Expression *addInvariant(Loc loc, Scope *sc, AggregateDeclaration *ad, VarDeclaration *vthis, bool direct)
{
Expression *e = NULL;
if (direct)
Expand Down Expand Up @@ -4051,7 +4053,7 @@ Expression *addInvariant(Scope *sc, AggregateDeclaration *ad, VarDeclaration *vt
Expression *se = new StringExp(Loc(), (char *)"null this");
se = se->semantic(sc);
se->type = Type::tchar->arrayOf();
e = new AssertExp(Loc(), v, se);
e = new AssertExp(loc, v, se);
}
return e;
}
Expand Down

0 comments on commit 7dd1d17

Please sign in to comment.