diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-02-27 19:31:52 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-02-27 19:31:52 +0000 |
commit | 99ebf651f1c3fd11eb648dc8d736c192c753f2cf (patch) | |
tree | ac62f9fe4e6d79d0da728a6741589187fce4eaba /lib/Sema/SemaTemplate.cpp | |
parent | 34c0533a005ad5be0356dbb913ab3a05fb6b3ca5 (diff) |
Implement the basic approach for instantiating types, with a lot of FIXME'd
stubs for those types we don't yet know how to instantiate (everything
that isn't a template parameter!).
We now instantiate default arguments for template type parameters when
needed. This will be our testbed while I fill out the remaining
type-instantiation logic.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65649 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplate.cpp')
-rw-r--r-- | lib/Sema/SemaTemplate.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index 5b2e89e8b0..aabbffa4c3 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -5,11 +5,11 @@ // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. -//+//===----------------------------------------------------------------------===/ +//===----------------------------------------------------------------------===/ // // This file implements semantic analysis for C++ templates. -//+//===----------------------------------------------------------------------===/ +//===----------------------------------------------------------------------===/ #include "Sema.h" #include "clang/AST/ASTContext.h" @@ -757,6 +757,17 @@ bool Sema::CheckTemplateArgumentList(TemplateDecl *Template, break; ArgType = TTP->getDefaultArgument(); + + // If the argument type is dependent, instantiate it now based + // on the previously-computed template arguments. + if (ArgType->isDependentType()) + ArgType = InstantiateType(ArgType, &Converted[0], Converted.size(), + TTP->getDefaultArgumentLoc(), + TTP->getDeclName()); + + if (ArgType.isNull()) + break; + ArgLoc = TTP->getDefaultArgumentLoc(); } else if (NonTypeTemplateParmDecl *NTTP = dyn_cast<NonTypeTemplateParmDecl>(*Param)) { |