Make the auto storage class never have the same meaning as scope.

This changes the meaning of
auto class MyClass {} and
auto MyClass ident;
Both have been made an error to prevent accidents.
This commit is contained in:
Christian Kamm
2009-07-12 16:15:21 +02:00
parent 756a2cb2a1
commit 72d1f1e6dd
9 changed files with 42 additions and 38 deletions

View File

@@ -333,7 +333,7 @@ void DeclarationStatement::scopeCode(Statement **sentry, Statement **sexception,
if (v)
{ Expression *e;
e = v->callAutoDtor();
e = v->callScopeDtor();
if (e)
{
//printf("dtor is: "); e->print();
@@ -1590,7 +1590,7 @@ Statement *ForeachStatement::semantic(Scope *sc)
{ VarDeclaration *v;
v = new VarDeclaration(loc, tret, Id::result, NULL);
v->noauto = 1;
v->noscope = 1;
v->semantic(sc);
if (!sc->insert(v))
assert(0);
@@ -1961,7 +1961,7 @@ Statement *IfStatement::semantic(Scope *sc)
Type *t = arg->type ? arg->type : condition->type;
match = new VarDeclaration(loc, t, arg->ident, NULL);
match->noauto = 1;
match->noscope = 1;
match->semantic(scd);
if (!scd->insert(match))
assert(0);
@@ -2931,7 +2931,7 @@ Statement *ReturnStatement::semantic(Scope *sc)
if (!fd->vresult)
{ // Declare vresult
VarDeclaration *v = new VarDeclaration(loc, tret, Id::result, NULL);
v->noauto = 1;
v->noscope = 1;
v->semantic(scx);
if (!scx->insert(v))
assert(0);