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
+2 -2
View File
@@ -3993,8 +3993,8 @@ void VarExp::checkEscape()
// if reference type
if (tb->ty == Tarray || tb->ty == Tsarray || tb->ty == Tclass)
{
if ((v->isAuto() || v->isScope()) && !v->noauto)
error("escaping reference to auto local %s", v->toChars());
if (v->isScope() && !v->noscope)
error("escaping reference to scope local %s", v->toChars());
else if (v->storage_class & STCvariadic)
error("escaping reference to variadic parameter %s", v->toChars());
}