diff options
author | David Blaikie <dblaikie@gmail.com> | 2011-12-04 05:04:18 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2011-12-04 05:04:18 +0000 |
commit | 42d6d0c91ab089cb252ab2f91c16d4557f458a2c (patch) | |
tree | 798a87db00244b0536a6b3880eb6c040218aa70d /lib/Sema/SemaCXXScopeSpec.cpp | |
parent | 649657e7d6c150136cae5ab22e39b9794cff80cc (diff) | |
download | clang-42d6d0c91ab089cb252ab2f91c16d4557f458a2c.tar.gz |
Support decltype in nested-name-specifiers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145785 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaCXXScopeSpec.cpp')
-rw-r--r-- | lib/Sema/SemaCXXScopeSpec.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/Sema/SemaCXXScopeSpec.cpp b/lib/Sema/SemaCXXScopeSpec.cpp index dfd59bfe4f..93f83256b0 100644 --- a/lib/Sema/SemaCXXScopeSpec.cpp +++ b/lib/Sema/SemaCXXScopeSpec.cpp @@ -676,6 +676,29 @@ bool Sema::ActOnCXXNestedNameSpecifier(Scope *S, /*ScopeLookupResult=*/0, false); } +bool Sema::ActOnCXXNestedNameSpecifierDecltype(CXXScopeSpec &SS, + const DeclSpec &DS, + SourceLocation ColonColonLoc) { + if (SS.isInvalid() || DS.getTypeSpecType() == DeclSpec::TST_error) + return true; + + assert(DS.getTypeSpecType() == DeclSpec::TST_decltype); + + QualType T = BuildDecltypeType(DS.getRepAsExpr(), DS.getTypeSpecTypeLoc()); + if (!T->isDependentType() && !T->getAs<TagType>()) { + Diag(DS.getTypeSpecTypeLoc(), diag::err_expected_class) + << T << getLangOptions().CPlusPlus; + return true; + } + + TypeLocBuilder TLB; + DecltypeTypeLoc DecltypeTL = TLB.push<DecltypeTypeLoc>(T); + DecltypeTL.setNameLoc(DS.getTypeSpecTypeLoc()); + SS.Extend(Context, SourceLocation(), TLB.getTypeLocInContext(Context, T), + ColonColonLoc); + return false; +} + /// IsInvalidUnlessNestedName - This method is used for error recovery /// purposes to determine whether the specified identifier is only valid as /// a nested name specifier, for example a namespace name. It is |