/// CXXScopeSpec that was passed to ActOnCXXEnterDeclaratorScope as well.
/// Used to indicate that names should revert to being looked up in the
/// defining scope.
- virtual void ActOnCXXExitDeclaratorScope(const CXXScopeSpec &SS) {
+ virtual void ActOnCXXExitDeclaratorScope(Scope *S, const CXXScopeSpec &SS) {
}
/// ActOnDeclarator - This callback is invoked when a declarator is parsed and
~DeclaratorScopeObj() {
if (SS.isSet())
- P.Actions.ActOnCXXExitDeclaratorScope(SS);
+ P.Actions.ActOnCXXExitDeclaratorScope(P.CurScope, SS);
}
};
/// CXXScopeSpec that was passed to ActOnCXXEnterDeclaratorScope as well.
/// Used to indicate that names should revert to being looked up in the
/// defining scope.
- virtual void ActOnCXXExitDeclaratorScope(const CXXScopeSpec &SS);
+ virtual void ActOnCXXExitDeclaratorScope(Scope *S, const CXXScopeSpec &SS);
// ParseObjCStringLiteral - Parse Objective-C string literals.
virtual ExprResult ParseObjCStringLiteral(SourceLocation *AtLocs,
void Sema::ActOnCXXEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS) {\r
assert(SS.isSet() && "Parser passed invalid CXXScopeSpec.");\r
assert(PreDeclaratorDC == 0 && "Previous declarator context not popped?");\r
- PreDeclaratorDC = CurContext;\r
- CurContext = static_cast<DeclContext*>(SS.getScopeRep());\r
+ PreDeclaratorDC = static_cast<DeclContext*>(S->getEntity());\r
+ S->setEntity(static_cast<DeclContext*>(SS.getScopeRep()));\r
}\r
\r
/// ActOnCXXExitDeclaratorScope - Called when a declarator that previously\r
/// CXXScopeSpec that was passed to ActOnCXXEnterDeclaratorScope as well.\r
/// Used to indicate that names should revert to being looked up in the\r
/// defining scope.\r
-void Sema::ActOnCXXExitDeclaratorScope(const CXXScopeSpec &SS) {\r
+void Sema::ActOnCXXExitDeclaratorScope(Scope *S, const CXXScopeSpec &SS) {\r
assert(SS.isSet() && "Parser passed invalid CXXScopeSpec.");\r
- assert(CurContext == static_cast<DeclContext*>(SS.getScopeRep()) &&\r
- "Context imbalance!");\r
- CurContext = PreDeclaratorDC;\r
+ assert(S->getEntity() == SS.getScopeRep() && "Context imbalance!");\r
+ S->setEntity(PreDeclaratorDC);\r
PreDeclaratorDC = 0;\r
}\r
Decl *Sema::LookupDecl(DeclarationName Name, unsigned NSI, Scope *S,
const DeclContext *LookupCtx,
bool enableLazyBuiltinCreation,
- bool LookInParent) {
+ bool LookInParent) {
if (!Name) return 0;
unsigned NS = NSI;
if (getLangOptions().CPlusPlus && (NS & Decl::IDNS_Ordinary))
int mem1(int i = a); // expected-error{{invalid use of nonstatic data member 'a'}}
// FIXME: The code below is well-formed.
// int mem2(int i = b); // OK; use X::b
+ int mem3(int i);
+ int mem4(int i);
static int b;
};
+
+int Y::mem3(int i = b) { return i; } // OK; use X::b
+
+int Y::mem4(int i = a) // expected-error{{invalid use of nonstatic data member 'a'}}
+{ return i; }