Skip to content

Commit

Permalink
fix Issue 14610 - [REG2.067] 'null this' assertion missing in 2.067
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed May 23, 2015
1 parent ba848af commit fb10be8
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/func.c
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 @@ -1466,7 +1466,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 @@ -1475,7 +1475,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 @@ -3991,8 +3991,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 @@ -4049,7 +4051,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 fb10be8

Please sign in to comment.