1 | // RUN: %clang_cc1 -fsyntax-only -verify %s -Wnon-pod-varargs |
2 | // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s -Wnon-pod-varargs |
3 | // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s -Wnon-pod-varargs |
4 | |
5 | class X { }; // expected-note {{the implicit copy constructor}} |
6 | // expected-note@-1 {{the implicit default constructor}} |
7 | #if __cplusplus >= 201103L // C++11 or later |
8 | // expected-note@-3 {{candidate constructor (the implicit move constructor) not viable}} |
9 | #endif |
10 | |
11 | int& copycon(X x); // expected-note{{passing argument to parameter}} |
12 | float& copycon(...); |
13 | |
14 | void test_copycon(X x, X const xc, X volatile xv) { |
15 | int& i1 = copycon(x); |
16 | int& i2 = copycon(xc); |
17 | copycon(xv); // expected-error{{no matching constructor}} |
18 | } |
19 | |
20 | class A { |
21 | public: |
22 | A(A&); // expected-note{{would lose const qualifier}} \ |
23 | // expected-note{{no known conversion}} |
24 | }; |
25 | |
26 | class B : public A { }; // expected-note{{would lose const qualifier}} \ |
27 | // expected-note{{would lose volatile qualifier}} \ |
28 | // expected-note 2{{requires 0 arguments}} |
29 | |
30 | short& copycon2(A a); // expected-note{{passing argument to parameter}} |
31 | int& copycon2(B b); // expected-note 2{{passing argument to parameter}} |
32 | float& copycon2(...); |
33 | |
34 | void test_copycon2(A a, const A ac, B b, B const bc, B volatile bv) { |
35 | int& i1 = copycon2(b); |
36 | copycon2(bc); // expected-error{{no matching constructor}} |
37 | copycon2(bv); // expected-error{{no matching constructor}} |
38 | short& s1 = copycon2(a); |
39 | copycon2(ac); // expected-error{{no matching constructor}} |
40 | } |
41 | |
42 | int& copycon3(A a); // expected-note{{passing argument to parameter 'a' here}} |
43 | float& copycon3(...); |
44 | |
45 | void test_copycon3(B b, const B bc) { |
46 | int& i1 = copycon3(b); |
47 | copycon3(bc); // expected-error{{no matching constructor}} |
48 | } |
49 | |
50 | class C : public B { }; |
51 | |
52 | float& copycon4(A a); |
53 | int& copycon4(B b); |
54 | |
55 | void test_copycon4(C c) { |
56 | int& i = copycon4(c); |
57 | }; |
58 | |