diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-02-20 03:19:35 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-02-20 03:19:35 +0000 |
| commit | 30482bc78659a3bf2bc8515bff417bc9887e9349 (patch) | |
| tree | b4b027ed95b4cb5438999e65259a7b1970e3800d /clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | |
| parent | ba1186c23e31207c2e11866beb978bd966a45e19 (diff) | |
| download | bcm5719-llvm-30482bc78659a3bf2bc8515bff417bc9887e9349.tar.gz bcm5719-llvm-30482bc78659a3bf2bc8515bff417bc9887e9349.zip | |
Implement the C++0x deduced 'auto' feature.
This fixes PR 8738, 9060 and 9132.
llvm-svn: 126069
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiateDecl.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index ecb9019136e..c0150c07bbf 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -324,19 +324,21 @@ Decl *TemplateDeclInstantiator::VisitVarDecl(VarDecl *D) { ASTOwningVector<Expr*> InitArgs(SemaRef); if (!InstantiateInitializer(SemaRef, D->getInit(), TemplateArgs, LParenLoc, InitArgs, RParenLoc)) { + bool TypeMayContainAuto = true; // Attach the initializer to the declaration, if we have one. if (InitArgs.size() == 0) - SemaRef.ActOnUninitializedDecl(Var, false); + SemaRef.ActOnUninitializedDecl(Var, TypeMayContainAuto); else if (D->hasCXXDirectInitializer()) { // Add the direct initializer to the declaration. SemaRef.AddCXXDirectInitializerToDecl(Var, LParenLoc, move_arg(InitArgs), - RParenLoc); + RParenLoc, + TypeMayContainAuto); } else { assert(InitArgs.size() == 1); Expr *Init = InitArgs.take()[0]; - SemaRef.AddInitializerToDecl(Var, Init, false); + SemaRef.AddInitializerToDecl(Var, Init, false, TypeMayContainAuto); } } else { // FIXME: Not too happy about invalidating the declaration |

