Improve recovery from ill-formed scope specifiers. Fixes PR3670.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66286 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index f4c2788..b25ba43 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -1209,7 +1209,11 @@
}
// See if this is a redefinition of a variable in the same scope.
- if (!D.getCXXScopeSpec().isSet() && !D.getCXXScopeSpec().isInvalid()) {
+ if (D.getCXXScopeSpec().isInvalid()) {
+ DC = CurContext;
+ PrevDecl = 0;
+ InvalidDecl = true;
+ } else if (!D.getCXXScopeSpec().isSet()) {
LookupNameKind NameKind = LookupOrdinaryName;
// If the declaration we're planning to build will be a function