blob: 1688e51e73fdf58c299e96590cc1e28fc0cc7861 [file] [log] [blame]
Shih-wei Liaoea285162010-06-04 12:34:56 -07001// RUN: %clang_cc1 -fsyntax-only -verify %s
2class Z { };
3
4class Y {
5public:
6 Y(const Z&);
7};
8
9class X {
10public:
11 X(int);
12 X(const Y&);
13};
14
15void f(X); // expected-note{{candidate function}}
16
17void g(short s, Y y, Z z) {
18 f(s);
19 f(1.0f);
20 f(y);
21 f(z); // expected-error{{no matching function}}
22}
23
24
25class FromShort {
26public:
27 FromShort(short s);
28};
29
30class FromShortExplicitly { // expected-note{{candidate constructor (the implicit copy constructor)}}
31public:
32 explicit FromShortExplicitly(short s);
33};
34
35void explicit_constructor(short s) {
36 FromShort fs1(s);
37 FromShort fs2 = s;
38 FromShortExplicitly fse1(s);
39 FromShortExplicitly fse2 = s; // expected-error{{no viable conversion}}
40}
41
42// PR5519
43struct X1 { X1(const char&); };
44void x1(X1);
45void y1() {
46 x1(1);
47}