[RISCV] Simplify usage of SplatPat_simm5_plus1. NFC (#125340)
[llvm-project.git] / clang / test / SemaTemplate / instantiate-template-template-parm.cpp
blobdce30aa2af4ee3dcbe76d882c2200090ecf3e1b4
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 template<template<typename T> class MetaFun, typename Value>
3 struct apply {
4 typedef typename MetaFun<Value>::type type;
5 };
7 template<class T>
8 struct add_pointer {
9 typedef T* type;
12 template<class T>
13 struct add_reference {
14 typedef T& type;
17 int i;
18 apply<add_pointer, int>::type ip = &i;
19 apply<add_reference, int>::type ir = i;
20 apply<add_reference, float>::type fr = i; // expected-error{{non-const lvalue reference to type 'float' cannot bind to a value of unrelated type 'int'}}
22 // Template template parameters
23 template<int> struct B;
25 template<typename T,
26 template<T Value> class X> // expected-error{{cannot have type 'float'}}
27 // expected-error@-1 {{cannot be narrowed from type 'long long' to 'int'}}
28 // expected-note@-2 {{previous template template parameter is here}}
29 struct X0 { };
31 X0<int, B> x0b1;
32 X0<float, B> x0b2; // expected-note{{while substituting}}
33 X0<long long, B> x0b3; // expected-note {{has different template parameters}}
35 template<template<int V> class TT>
36 struct X1 { };
38 template<typename T, template<T V> class TT>
39 struct X2 {
40 X1<TT> x1;
43 template<int V> struct X3i { };
44 template<long V> struct X3l { };
46 X2<int, X3i> x2okay;
47 X2<long, X3l> x2okay2;
49 template <typename T, template <T, T> class TT, class R = TT<1, 2> >
50 struct Comp {
51 typedef R r1;
52 template <T x, T y> struct gt {
53 static const bool result = x > y;
55 typedef gt<2, 1> r2;
58 template <int x, int y> struct lt {
59 static const bool result = x < y;
62 Comp<int, lt> c0;
64 namespace PR8629 {
65 template<template<int> class TT> struct X0
67 static void apply();
69 template<int> struct Type { };
71 template<class T> struct X1
73 template<class U> struct Inner;
75 template<class U> void g()
77 typedef Inner<U> Init;
78 X0<Init::template VeryInner>::apply();
80 template<int N> void f ()
82 g<Type<N> >();
85 template<class T> template<class U> struct X1<T>::Inner
87 template<int> struct VeryInner {
90 struct X1Container
92 X1Container()
94 simplex_.f<0>();
96 X1<double> simplex_;