Parser &P;
CXXScopeSpec &SS;
bool EnteredScope;
+ bool CreatedScope;
public:
DeclaratorScopeObj(Parser &p, CXXScopeSpec &ss)
- : P(p), SS(ss), EnteredScope(false) {}
+ : P(p), SS(ss), EnteredScope(false), CreatedScope(false) {}
void EnterDeclaratorScope() {
assert(!EnteredScope && "Already entered the scope!");
assert(SS.isSet() && "C++ scope was not set!");
+
+ CreatedScope = true;
+ P.EnterScope(0); // Not a decl scope.
+
if (P.Actions.ActOnCXXEnterDeclaratorScope(P.CurScope, SS))
SS.setScopeRep(0);
assert(SS.isSet() && "C++ scope was cleared ?");
P.Actions.ActOnCXXExitDeclaratorScope(P.CurScope, SS);
}
+ if (CreatedScope)
+ P.ExitScope();
}
};
assert(InnermostFileDC && InnermostFileDC->isFileContext());
for (; S; S = S->getParent()) {
- if (!(S->getFlags() & Scope::DeclScope))
- continue;
-
if (DeclContext *Ctx = static_cast<DeclContext*>(S->getEntity())) {
DeclContext *EffectiveDC = (Ctx->isFileContext() ? Ctx : InnermostFileDC);
visit(Ctx, EffectiveDC);
return foo(); // expected-error {{call to 'foo' is ambiguous}}
}
}
+
+// Bug: using directives should be followed when parsing default
+// arguments in scoped declarations.
+class test5 {
+ int inc(int x);
+};
+namespace Test5 {
+ int default_x = 0;
+}
+using namespace Test5;
+int test5::inc(int x = default_x) {
+ return x+1;
+}