Fix a crash that occurs in this C++ case:

struct foo {
  static bool value;
};
bool (foo::value); // crash because of parens

llvm-svn: 76538
This commit is contained in:
Argyrios Kyrtzidis 2009-07-21 06:43:26 +00:00
parent 83423aa276
commit 1a176f0b96
2 changed files with 13 additions and 5 deletions

View File

@ -1080,17 +1080,22 @@ private:
class DeclaratorScopeObj {
Parser &P;
CXXScopeSpec &SS;
bool EnteredScope;
public:
DeclaratorScopeObj(Parser &p, CXXScopeSpec &ss) : P(p), SS(ss) {}
DeclaratorScopeObj(Parser &p, CXXScopeSpec &ss)
: P(p), SS(ss), EnteredScope(false) {}
void EnterDeclaratorScope() {
if (SS.isSet())
P.Actions.ActOnCXXEnterDeclaratorScope(P.CurScope, SS);
assert(SS.isSet() && "C++ scope was not set!");
P.Actions.ActOnCXXEnterDeclaratorScope(P.CurScope, SS);
EnteredScope = true;
}
~DeclaratorScopeObj() {
if (SS.isSet())
if (EnteredScope) {
assert(SS.isSet() && "C++ scope was cleared ?");
P.Actions.ActOnCXXExitDeclaratorScope(P.CurScope, SS);
}
}
};

View File

@ -172,7 +172,10 @@ X::X() : a(5) { } // expected-error{{use of undeclared identifier 'X'}} \
// expected-error{{C++ requires a type specifier for all declarations}} \
// expected-error{{only constructors take base initializers}}
struct foo_S {
static bool value;
};
bool (foo_S::value);
namespace somens {