58 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s -Wnon-pod-varargs2// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s -Wnon-pod-varargs3// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s -Wnon-pod-varargs4 5class X { }; // expected-note {{the implicit copy constructor}}6// expected-note@-1 {{the implicit default constructor}}7#if __cplusplus >= 201103L // C++11 or later8// expected-note@-3 {{candidate constructor (the implicit move constructor) not viable}}9#endif10 11int& copycon(X x); // expected-note{{passing argument to parameter}}12float& copycon(...);13 14void 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 20class A {21public:22 A(A&); // expected-note{{would lose const qualifier}} \23 // expected-note{{no known conversion}}24};25 26class B : public A { }; // expected-note{{would lose const qualifier}} \27// expected-note{{would lose volatile qualifier}} \28// expected-note 2{{requires 0 arguments}}29 30short& copycon2(A a); // expected-note{{passing argument to parameter}}31int& copycon2(B b); // expected-note 2{{passing argument to parameter}}32float& copycon2(...);33 34void 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 42int& copycon3(A a); // expected-note{{passing argument to parameter 'a' here}}43float& copycon3(...);44 45void test_copycon3(B b, const B bc) {46 int& i1 = copycon3(b);47 copycon3(bc); // expected-error{{no matching constructor}}48}49 50class C : public B { };51 52float& copycon4(A a);53int& copycon4(B b);54 55void test_copycon4(C c) {56 int& i = copycon4(c);57};58