blob: a21e4cf060d903a7189e75ff57ea423f6d9af7ca [file] [log] [blame]
Eli Friedman924d5c92012-11-14 23:57:08 +00001// RUN: %clang_cc1 -fsyntax-only %s -std=c++98 2>&1 | FileCheck %s
2
3namespace PR14342 {
4 template<typename T, char a> struct X {};
5 X<int, 1> x = X<long, 257>();
6 // CHECK: error: no viable conversion from 'X<long, [...]>' to 'X<int, [...]>'
Douglas Gregor7f99d5c2013-03-14 20:44:43 +00007}
8
9namespace PR15513 {
10 template <int x, int y = x+1>
11 class A {};
12
13 void foo(A<0> &M) {
Richard Trieu70e82dc2013-03-15 23:55:09 +000014 // CHECK: no viable conversion from 'A<[...], (default) x + 1 aka 1>' to 'A<[...], 0>'
Douglas Gregor7f99d5c2013-03-14 20:44:43 +000015 A<0, 0> N = M;
Richard Trieu70e82dc2013-03-15 23:55:09 +000016 // CHECK: no viable conversion from 'A<0, [...]>' to 'A<1, [...]>'
17 A<1, 1> O = M;
Douglas Gregor7f99d5c2013-03-14 20:44:43 +000018 }
19}
Richard Trieu70e82dc2013-03-15 23:55:09 +000020
21namespace default_args {
22 template <int x, int y = 1+1, int z = 2>
23 class A {};
24
25 void foo(A<0> &M) {
26 // CHECK: no viable conversion from 'A<[...], (default) 1 + 1 aka 2, (default) 2>' to 'A<[...], 0, 0>'
27 A<0, 0, 0> N = M;
28
29 // CHECK: no viable conversion from 'A<[2 * ...], (default) 2>' to 'A<[2 * ...], 0>'
30 A<0, 2, 0> N2 = M;
31 }
32
33}
Richard Trieu060fe332013-03-23 01:38:36 +000034
35namespace qualifiers {
36 template <class T>
37 void foo(void (func(T*)), T*) {}
38
39 template <class T>
40 class vector{};
41
42 void bar(const vector<int>*) {}
43
44 void test(volatile vector<int>* V) {
45 foo(bar, V);
46 }
47
48 // CHECK: candidate template ignored: deduced conflicting types for parameter 'T' ('const vector<[...]>' vs. 'volatile vector<[...]>')
49}