summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaTemplate/instantiate-template-template-parm.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-11-12 16:20:59 +0000
committerDouglas Gregor <dgregor@apple.com>2009-11-12 16:20:59 +0000
commit19ac2d6494621c6b574a72f1735011c72be1d961 (patch)
tree828e7fb4a76460acfc44700029b8ac5e97924137 /clang/test/SemaTemplate/instantiate-template-template-parm.cpp
parent068ae76e02df791c82bdf87a2ea37dff31b297e7 (diff)
downloadbcm5719-llvm-19ac2d6494621c6b574a72f1735011c72be1d961.tar.gz
bcm5719-llvm-19ac2d6494621c6b574a72f1735011c72be1d961.zip
When comparing template parameter lists, distinguish between three cases:
- Comparing template parameter lists to determine if we have a redeclaration - Comparing template parameter lists to determine if we have equivalent template template parameters - Comparing template parameter lists to determine whether a template template argument is valid for a given template template parameter. Previously, we did not distinguish between the last two cases, which got us into trouble when we were looking for exact type matches between the types of non-type template parameters that were dependent types. Now we do, so we properly delay checking of template template arguments until instantiation time. Also, fix an accidental fall-through in a case statement that was causing crashes. llvm-svn: 86992
Diffstat (limited to 'clang/test/SemaTemplate/instantiate-template-template-parm.cpp')
-rw-r--r--clang/test/SemaTemplate/instantiate-template-template-parm.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/clang/test/SemaTemplate/instantiate-template-template-parm.cpp b/clang/test/SemaTemplate/instantiate-template-template-parm.cpp
index 00b2c0ecc2f..30ba113e20d 100644
--- a/clang/test/SemaTemplate/instantiate-template-template-parm.cpp
+++ b/clang/test/SemaTemplate/instantiate-template-template-parm.cpp
@@ -1,5 +1,4 @@
// RUN: clang-cc -fsyntax-only -verify %s
-
template<template<typename T> class MetaFun, typename Value>
struct apply {
typedef typename MetaFun<Value>::type type;
@@ -31,3 +30,17 @@ struct X0 { };
X0<int, B> x0b1;
X0<float, B> x0b2; // expected-note{{while substituting}}
X0<long, B> x0b3; // expected-error{{template template argument has different template parameters}}
+
+template<template<int V> class TT> // expected-note{{parameter with type 'int'}}
+struct X1 { };
+
+template<typename T, template<T V> class TT>
+struct X2 {
+ X1<TT> x1; // expected-error{{has different template parameters}}
+};
+
+template<int V> struct X3i { };
+template<long V> struct X3l { }; // expected-note{{different type 'long'}}
+
+X2<int, X3i> x2okay;
+X2<long, X3l> x2bad; // expected-note{{instantiation}}
OpenPOWER on IntegriCloud