diff options
author | David Blaikie <dblaikie@gmail.com> | 2012-01-24 06:03:59 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2012-01-24 06:03:59 +0000 |
commit | f211662199c87461f3b1475a549ab439c63ca83b (patch) | |
tree | b85f9799d11d1211e13acdd6350f97bfb786f51b /lib/Sema/SemaDeclCXX.cpp | |
parent | 5e089fe1affb63d670ea02010b104bd9fa3477a1 (diff) |
Support decltype in member initializers.
This is the last piece of N3031 (decltype in weird places) - supporting
the use of decltype in a class ctor's member-initializer-list to
specify the base classes to initialize.
Reviewed by Richard Smith.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148789 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclCXX.cpp')
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index b706cdc9fb..3f8f585bb0 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -1722,11 +1722,13 @@ Sema::ActOnMemInitializer(Decl *ConstructorD, CXXScopeSpec &SS, IdentifierInfo *MemberOrBase, ParsedType TemplateTypeTy, + const DeclSpec &DS, SourceLocation IdLoc, Expr *InitList, SourceLocation EllipsisLoc) { return BuildMemInitializer(ConstructorD, S, SS, MemberOrBase, TemplateTypeTy, - IdLoc, MultiInitializer(InitList), EllipsisLoc); + DS, IdLoc, MultiInitializer(InitList), + EllipsisLoc); } /// \brief Handle a C++ member initializer using parentheses syntax. @@ -1736,14 +1738,15 @@ Sema::ActOnMemInitializer(Decl *ConstructorD, CXXScopeSpec &SS, IdentifierInfo *MemberOrBase, ParsedType TemplateTypeTy, + const DeclSpec &DS, SourceLocation IdLoc, SourceLocation LParenLoc, Expr **Args, unsigned NumArgs, SourceLocation RParenLoc, SourceLocation EllipsisLoc) { return BuildMemInitializer(ConstructorD, S, SS, MemberOrBase, TemplateTypeTy, - IdLoc, MultiInitializer(LParenLoc, Args, NumArgs, - RParenLoc), + DS, IdLoc, MultiInitializer(LParenLoc, Args, + NumArgs, RParenLoc), EllipsisLoc); } @@ -1779,6 +1782,7 @@ Sema::BuildMemInitializer(Decl *ConstructorD, CXXScopeSpec &SS, IdentifierInfo *MemberOrBase, ParsedType TemplateTypeTy, + const DeclSpec &DS, SourceLocation IdLoc, const MultiInitializer &Args, SourceLocation EllipsisLoc) { @@ -1831,6 +1835,8 @@ Sema::BuildMemInitializer(Decl *ConstructorD, if (TemplateTypeTy) { BaseType = GetTypeFromParser(TemplateTypeTy, &TInfo); + } else if (DS.getTypeSpecType() == TST_decltype) { + BaseType = BuildDecltypeType(DS.getRepAsExpr(), DS.getTypeSpecTypeLoc()); } else { LookupResult R(*this, MemberOrBase, IdLoc, LookupOrdinaryName); LookupParsedName(R, S, &SS); |