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:
parent
83423aa276
commit
1a176f0b96
|
@ -1080,17 +1080,22 @@ private:
|
||||||
class DeclaratorScopeObj {
|
class DeclaratorScopeObj {
|
||||||
Parser &P;
|
Parser &P;
|
||||||
CXXScopeSpec &SS;
|
CXXScopeSpec &SS;
|
||||||
|
bool EnteredScope;
|
||||||
public:
|
public:
|
||||||
DeclaratorScopeObj(Parser &p, CXXScopeSpec &ss) : P(p), SS(ss) {}
|
DeclaratorScopeObj(Parser &p, CXXScopeSpec &ss)
|
||||||
|
: P(p), SS(ss), EnteredScope(false) {}
|
||||||
|
|
||||||
void EnterDeclaratorScope() {
|
void EnterDeclaratorScope() {
|
||||||
if (SS.isSet())
|
assert(SS.isSet() && "C++ scope was not set!");
|
||||||
P.Actions.ActOnCXXEnterDeclaratorScope(P.CurScope, SS);
|
P.Actions.ActOnCXXEnterDeclaratorScope(P.CurScope, SS);
|
||||||
|
EnteredScope = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
~DeclaratorScopeObj() {
|
~DeclaratorScopeObj() {
|
||||||
if (SS.isSet())
|
if (EnteredScope) {
|
||||||
|
assert(SS.isSet() && "C++ scope was cleared ?");
|
||||||
P.Actions.ActOnCXXExitDeclaratorScope(P.CurScope, SS);
|
P.Actions.ActOnCXXExitDeclaratorScope(P.CurScope, SS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -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{{C++ requires a type specifier for all declarations}} \
|
||||||
// expected-error{{only constructors take base initializers}}
|
// expected-error{{only constructors take base initializers}}
|
||||||
|
|
||||||
|
struct foo_S {
|
||||||
|
static bool value;
|
||||||
|
};
|
||||||
|
bool (foo_S::value);
|
||||||
|
|
||||||
|
|
||||||
namespace somens {
|
namespace somens {
|
||||||
|
|
Loading…
Reference in New Issue