Douglas Gregor | ad323a8 | 2010-01-27 03:51:04 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s -Wnon-pod-varargs |
Douglas Gregor | 604eb65 | 2010-08-11 02:15:33 +0000 | [diff] [blame] | 2 | class X { }; // expected-note {{the implicit copy constructor}} \ |
| 3 | // expected-note{{the implicit default constructor}} |
Douglas Gregor | 396b7cd | 2008-11-03 17:51:48 +0000 | [diff] [blame] | 4 | |
Douglas Gregor | 604eb65 | 2010-08-11 02:15:33 +0000 | [diff] [blame] | 5 | int& copycon(X x); // expected-note{{passing argument to parameter}} |
Douglas Gregor | 396b7cd | 2008-11-03 17:51:48 +0000 | [diff] [blame] | 6 | float& copycon(...); |
| 7 | |
| 8 | void test_copycon(X x, X const xc, X volatile xv) { |
| 9 | int& i1 = copycon(x); |
| 10 | int& i2 = copycon(xc); |
Douglas Gregor | 604eb65 | 2010-08-11 02:15:33 +0000 | [diff] [blame] | 11 | copycon(xv); // expected-error{{no matching constructor}} |
Douglas Gregor | 396b7cd | 2008-11-03 17:51:48 +0000 | [diff] [blame] | 12 | } |
| 13 | |
| 14 | class A { |
| 15 | public: |
Douglas Gregor | 604eb65 | 2010-08-11 02:15:33 +0000 | [diff] [blame] | 16 | A(A&); // expected-note{{would lose const qualifier}} \ |
| 17 | // expected-note{{no known conversion}} |
Douglas Gregor | 396b7cd | 2008-11-03 17:51:48 +0000 | [diff] [blame] | 18 | }; |
| 19 | |
Douglas Gregor | 604eb65 | 2010-08-11 02:15:33 +0000 | [diff] [blame] | 20 | class B : public A { }; // expected-note{{would lose const qualifier}} \ |
| 21 | // expected-note{{would lose volatile qualifier}} \ |
| 22 | // expected-note 2{{requires 0 arguments}} |
Douglas Gregor | 396b7cd | 2008-11-03 17:51:48 +0000 | [diff] [blame] | 23 | |
Douglas Gregor | 604eb65 | 2010-08-11 02:15:33 +0000 | [diff] [blame] | 24 | short& copycon2(A a); // expected-note{{passing argument to parameter}} |
| 25 | int& copycon2(B b); // expected-note 2{{passing argument to parameter}} |
Douglas Gregor | 396b7cd | 2008-11-03 17:51:48 +0000 | [diff] [blame] | 26 | float& copycon2(...); |
| 27 | |
| 28 | void test_copycon2(A a, const A ac, B b, B const bc, B volatile bv) { |
| 29 | int& i1 = copycon2(b); |
Douglas Gregor | 604eb65 | 2010-08-11 02:15:33 +0000 | [diff] [blame] | 30 | copycon2(bc); // expected-error{{no matching constructor}} |
| 31 | copycon2(bv); // expected-error{{no matching constructor}} |
Douglas Gregor | 396b7cd | 2008-11-03 17:51:48 +0000 | [diff] [blame] | 32 | short& s1 = copycon2(a); |
Douglas Gregor | 604eb65 | 2010-08-11 02:15:33 +0000 | [diff] [blame] | 33 | copycon2(ac); // expected-error{{no matching constructor}} |
Douglas Gregor | 396b7cd | 2008-11-03 17:51:48 +0000 | [diff] [blame] | 34 | } |
| 35 | |
Douglas Gregor | 604eb65 | 2010-08-11 02:15:33 +0000 | [diff] [blame] | 36 | int& copycon3(A a); // expected-note{{passing argument to parameter 'a' here}} |
Douglas Gregor | 396b7cd | 2008-11-03 17:51:48 +0000 | [diff] [blame] | 37 | float& copycon3(...); |
| 38 | |
| 39 | void test_copycon3(B b, const B bc) { |
| 40 | int& i1 = copycon3(b); |
Douglas Gregor | 604eb65 | 2010-08-11 02:15:33 +0000 | [diff] [blame] | 41 | copycon3(bc); // expected-error{{no matching constructor}} |
Douglas Gregor | 396b7cd | 2008-11-03 17:51:48 +0000 | [diff] [blame] | 42 | } |
Douglas Gregor | 225c41e | 2008-11-03 19:09:14 +0000 | [diff] [blame] | 43 | |
Douglas Gregor | 225c41e | 2008-11-03 19:09:14 +0000 | [diff] [blame] | 44 | class C : public B { }; |
| 45 | |
| 46 | float& copycon4(A a); |
| 47 | int& copycon4(B b); |
| 48 | |
| 49 | void test_copycon4(C c) { |
| 50 | int& i = copycon4(c); |
| 51 | }; |