aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2011-12-13 08:03:36 +0000
committerDavid Blaikie <dblaikie@gmail.com>2011-12-13 08:03:36 +0000
commitdf512bfbc4b8c00202ea7a8c900c59ec55890676 (patch)
treebd01bd563b330a89de589e462f6efeb7a1d15c48 /lib/Sema/SemaDecl.cpp
parentc1c5f27c64dfc3332d53ad30e44d626e4f9afac3 (diff)
Disallow decltype in qualified declarator-ids.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146480 91177308-0d34-0410-b5e6-96231b3b80d8
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();