Daniel Dunbar | d7d5f02 | 2009-03-24 02:24:46 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fsyntax-only %s |
Douglas Gregor | 396b7cd | 2008-11-03 17:51:48 +0000 | [diff] [blame] | 2 | class X { }; |
| 3 | |
| 4 | int& copycon(X x); |
| 5 | float& copycon(...); |
| 6 | |
| 7 | void test_copycon(X x, X const xc, X volatile xv) { |
| 8 | int& i1 = copycon(x); |
| 9 | int& i2 = copycon(xc); |
| 10 | float& f1 = copycon(xv); |
| 11 | } |
| 12 | |
| 13 | class A { |
| 14 | public: |
| 15 | A(A&); |
| 16 | }; |
| 17 | |
| 18 | class B : public A { }; |
| 19 | |
| 20 | short& copycon2(A a); |
| 21 | int& copycon2(B b); |
| 22 | float& copycon2(...); |
| 23 | |
| 24 | void test_copycon2(A a, const A ac, B b, B const bc, B volatile bv) { |
| 25 | int& i1 = copycon2(b); |
| 26 | float& f1 = copycon2(bc); |
| 27 | float& f2 = copycon2(bv); |
| 28 | short& s1 = copycon2(a); |
| 29 | float& f3 = copycon2(ac); |
| 30 | } |
| 31 | |
| 32 | int& copycon3(A a); |
| 33 | float& copycon3(...); |
| 34 | |
| 35 | void test_copycon3(B b, const B bc) { |
| 36 | int& i1 = copycon3(b); |
| 37 | float& f1 = copycon3(bc); |
| 38 | } |
Douglas Gregor | 225c41e | 2008-11-03 19:09:14 +0000 | [diff] [blame] | 39 | |
| 40 | |
| 41 | class C : public B { }; |
| 42 | |
| 43 | float& copycon4(A a); |
| 44 | int& copycon4(B b); |
| 45 | |
| 46 | void test_copycon4(C c) { |
| 47 | int& i = copycon4(c); |
| 48 | }; |