aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index bd2e639eab..63a1b8034e 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -3203,6 +3203,16 @@ Decl *Sema::HandleDeclarator(Scope *S, Declarator &D,
(S->getFlags() & Scope::TemplateParamScope) != 0)
S = S->getParent();
+ if (NestedNameSpecifierLoc SpecLoc =
+ D.getCXXScopeSpec().getWithLocInContext(Context)) {
+ while (SpecLoc.getPrefix())
+ SpecLoc = SpecLoc.getPrefix();
+ if (dyn_cast_or_null<DecltypeType>(
+ SpecLoc.getNestedNameSpecifier()->getAsType()))
+ Diag(SpecLoc.getBeginLoc(), diag::err_decltype_in_declarator)
+ << SpecLoc.getTypeLoc().getSourceRange();
+ }
+
DeclContext *DC = CurContext;
if (D.getCXXScopeSpec().isInvalid())
D.setInvalidType();