complete (or, possibly causing template instantiation).
Test this via some explicit specializations of member functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82732
91177308-0d34-0410-b5e6-
96231b3b80d8
/// looked up in the declarator-id's scope, until the declarator is parsed and
/// ActOnCXXExitDeclaratorScope is called.
/// The 'SS' should be a non-empty valid CXXScopeSpec.
- virtual void ActOnCXXEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS) {
+ /// \returns true if an error occurred, false otherwise.
+ virtual bool ActOnCXXEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS) {
+ return false;
}
/// ActOnCXXExitDeclaratorScope - Called when a declarator that previously
void EnterDeclaratorScope() {
assert(!EnteredScope && "Already entered the scope!");
assert(SS.isSet() && "C++ scope was not set!");
- P.Actions.ActOnCXXEnterDeclaratorScope(P.CurScope, SS);
+ if (P.Actions.ActOnCXXEnterDeclaratorScope(P.CurScope, SS))
+ SS.setScopeRep(0);
+
if (!SS.isInvalid())
EnteredScope = true;
}
/// looked up in the declarator-id's scope, until the declarator is parsed and
/// ActOnCXXExitDeclaratorScope is called.
/// The 'SS' should be a non-empty valid CXXScopeSpec.
- virtual void ActOnCXXEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS);
+ virtual bool ActOnCXXEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS);
/// ActOnCXXExitDeclaratorScope - Called when a declarator that previously
/// invoked ActOnCXXEnterDeclaratorScope(), is finished. 'SS' is the same
/// looked up in the declarator-id's scope, until the declarator is parsed and
/// ActOnCXXExitDeclaratorScope is called.
/// The 'SS' should be a non-empty valid CXXScopeSpec.
-void Sema::ActOnCXXEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS) {
+bool Sema::ActOnCXXEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS) {
assert(SS.isSet() && "Parser passed invalid CXXScopeSpec.");
- if (DeclContext *DC = computeDeclContext(SS, true))
+ if (DeclContext *DC = computeDeclContext(SS, true)) {
+ // Before we enter a declarator's context, we need to make sure that
+ // it is a complete declaration context.
+ if (!DC->isDependentContext() && RequireCompleteDeclContext(SS))
+ return true;
+
EnterDeclaratorContext(S, DC);
+ }
+
+ return false;
}
/// ActOnCXXExitDeclaratorScope - Called when a declarator that previously
--- /dev/null
+// RUN: clang-cc -fsyntax-only -verify %s
+template<typename T>
+struct X0 {
+ typedef T* type;
+
+ void f0(T);
+ void f1(type);
+};
+
+template<> void X0<char>::f0(char);
+template<> void X0<char>::f1(type);