blob: 59b793e3f28c68ef28f02b36bb8627a3e8988269 [file] [log] [blame]
Daniel Dunbard7d5f022009-03-24 02:24:46 +00001// RUN: clang-cc -fsyntax-only -verify %s
Douglas Gregor60d62c22008-10-31 16:23:19 +00002class Z { };
3
4class Y {
5public:
6 Y(const Z&);
7};
8
9class X {
10public:
11 X(int);
12 X(const Y&);
13};
14
Douglas Gregorfa047642009-02-04 00:32:51 +000015void f(X); // expected-note{{candidate function}}
Douglas Gregor60d62c22008-10-31 16:23:19 +000016
17void g(short s, Y y, Z z) {
18 f(s);
19 f(1.0f);
20 f(y);
Douglas Gregorfa047642009-02-04 00:32:51 +000021 f(z); // expected-error{{no matching function}}
Douglas Gregor60d62c22008-10-31 16:23:19 +000022}
23
Douglas Gregorbf985f12009-01-14 18:02:48 +000024
25class FromShort {
26public:
27 FromShort(short s);
28};
29
30class FromShortExplicitly {
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{{error: cannot initialize 'fse2' with an lvalue of type 'short'}}
40}