aboutsummaryrefslogtreecommitdiff
path: root/test/SemaTemplate/default-arguments.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-11-11 19:13:48 +0000
committerDouglas Gregor <dgregor@apple.com>2009-11-11 19:13:48 +0000
commit9148c3f5829f4d031249faeb1043e7be914539e8 (patch)
treed5f2fd92a95c10fcb8f9c063e5a9865781236504 /test/SemaTemplate/default-arguments.cpp
parentf465e85fd8744fce8769f18f0dbfec51dbc6d4af (diff)
Before checking a template template argument against its corresponding
template template parameter, substitute any prior template arguments into the template template parameter. This, for example, allows us to properly check the template template argument for a class such as: template<typename T, template<T Value> class X> struct Foo; The actual implementation of this feature was trivial; most of the change is dedicated to giving decent diagnostics when this substitution goes horribly wrong. We now get a note like: note: while substituting prior template arguments into template template parameter 'X' [with T = float] As part of this change, enabled some very pedantic checking when comparing template template parameter lists, which shook out a bug in our overly-eager checking of default arguments of template template parameters. We now perform only minimal checking of such default arguments when they are initially parsed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86864 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate/default-arguments.cpp')
-rw-r--r--test/SemaTemplate/default-arguments.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/SemaTemplate/default-arguments.cpp b/test/SemaTemplate/default-arguments.cpp
index 8352afdb0d..e1999218dd 100644
--- a/test/SemaTemplate/default-arguments.cpp
+++ b/test/SemaTemplate/default-arguments.cpp
@@ -107,3 +107,14 @@ template<typename T, template<typename> class X = T::template apply>
struct X4;
int array4[is_same<X4<add_pointer>,
X4<add_pointer, add_pointer::apply> >::value? 1 : -1];
+
+template<int> struct X5 {}; // expected-note{{has a different type 'int'}}
+template<long> struct X5b {};
+template<typename T,
+ template<T> class B = X5> // expected-error{{template template argument has different}} \
+ // expected-note{{previous non-type template parameter}}
+ struct X6 {};
+
+X6<int> x6a;
+X6<long> x6b;
+X6<long, X5b> x6c;