Douglas Gregor | 225c41e | 2008-11-03 19:09:14 +0000 | [diff] [blame] | 1 | // RUN: clang -fsyntax-only -verify %s |
Douglas Gregor | 60d62c2 | 2008-10-31 16:23:19 +0000 | [diff] [blame] | 2 | class Z { }; |
| 3 | |
| 4 | class Y { |
| 5 | public: |
| 6 | Y(const Z&); |
| 7 | }; |
| 8 | |
| 9 | class X { |
| 10 | public: |
| 11 | X(int); |
| 12 | X(const Y&); |
| 13 | }; |
| 14 | |
Douglas Gregor | fa04764 | 2009-02-04 00:32:51 +0000 | [diff] [blame] | 15 | void f(X); // expected-note{{candidate function}} |
Douglas Gregor | 60d62c2 | 2008-10-31 16:23:19 +0000 | [diff] [blame] | 16 | |
| 17 | void g(short s, Y y, Z z) { |
| 18 | f(s); |
| 19 | f(1.0f); |
| 20 | f(y); |
Douglas Gregor | fa04764 | 2009-02-04 00:32:51 +0000 | [diff] [blame] | 21 | f(z); // expected-error{{no matching function}} |
Douglas Gregor | 60d62c2 | 2008-10-31 16:23:19 +0000 | [diff] [blame] | 22 | } |
| 23 | |
Douglas Gregor | bf985f1 | 2009-01-14 18:02:48 +0000 | [diff] [blame] | 24 | |
| 25 | class FromShort { |
| 26 | public: |
| 27 | FromShort(short s); |
| 28 | }; |
| 29 | |
| 30 | class FromShortExplicitly { |
| 31 | public: |
| 32 | explicit FromShortExplicitly(short s); |
| 33 | }; |
| 34 | |
| 35 | void 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 | } |