blob: 00b2c0ecc2f20efea1579a50b830d276ecfc842b [file] [log] [blame]
Douglas Gregorde650ae2009-03-31 18:38:02 +00001// RUN: clang-cc -fsyntax-only -verify %s
2
3template<template<typename T> class MetaFun, typename Value>
4struct apply {
5 typedef typename MetaFun<Value>::type type;
6};
7
8template<class T>
9struct add_pointer {
10 typedef T* type;
11};
12
13template<class T>
14struct add_reference {
15 typedef T& type;
16};
17
18int i;
19apply<add_pointer, int>::type ip = &i;
20apply<add_reference, int>::type ir = i;
21apply<add_reference, float>::type fr = i; // expected-error{{non-const lvalue reference to type 'float' cannot be initialized with a value of type 'int'}}
Douglas Gregor9148c3f2009-11-11 19:13:48 +000022
23// Template template parameters
24template<int> struct B; // expected-note{{has a different type 'int'}}
25
26template<typename T,
27 template<T Value> class X> // expected-error{{cannot have type 'float'}} \
28 // expected-note{{with type 'long'}}
29struct X0 { };
30
31X0<int, B> x0b1;
32X0<float, B> x0b2; // expected-note{{while substituting}}
33X0<long, B> x0b3; // expected-error{{template template argument has different template parameters}}