diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-06-12 21:21:02 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-06-12 21:21:02 +0000 |
commit | e94866ffc12d33d30b351f30aac4aa3828bc05d7 (patch) | |
tree | 093ed36b2a82d220682404c1bb41d55cbf813d4c /lib/Sema/SemaTemplateInstantiateExpr.cpp | |
parent | 0b32600195ad729de9e78f073aa509cd9991d52e (diff) |
Diagnose the incorrect use of non-type template arguments for class
template partial specializations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73254 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiateExpr.cpp')
-rw-r--r-- | lib/Sema/SemaTemplateInstantiateExpr.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Sema/SemaTemplateInstantiateExpr.cpp b/lib/Sema/SemaTemplateInstantiateExpr.cpp index fa5fdee2c1..3c67f2ad0d 100644 --- a/lib/Sema/SemaTemplateInstantiateExpr.cpp +++ b/lib/Sema/SemaTemplateInstantiateExpr.cpp @@ -112,6 +112,14 @@ TemplateExprInstantiator::VisitDeclRefExpr(DeclRefExpr *E) { if (NonTypeTemplateParmDecl *NTTP = dyn_cast<NonTypeTemplateParmDecl>(D)) { assert(NTTP->getDepth() == 0 && "No nested templates yet"); const TemplateArgument &Arg = TemplateArgs[NTTP->getPosition()]; + + // The template argument itself might be an expression, in which + // case we just return that expression. + if (Arg.getKind() == TemplateArgument::Expression) + // FIXME: Clone the expression! + return SemaRef.Owned(Arg.getAsExpr()); + + assert(Arg.getKind() == TemplateArgument::Integral); QualType T = Arg.getIntegralType(); if (T->isCharType() || T->isWideCharType()) return SemaRef.Owned(new (SemaRef.Context) CharacterLiteral( |