• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -fsyntax-only -verify %s -Wnon-pod-varargs
2 class X { }; // expected-note {{the implicit copy constructor}} \
3              // expected-note{{the implicit default constructor}}
4 
5 int& copycon(X x); // expected-note{{passing argument to parameter}}
6 float& copycon(...);
7 
test_copycon(X x,X const xc,X volatile xv)8 void test_copycon(X x, X const xc, X volatile xv) {
9   int& i1 = copycon(x);
10   int& i2 = copycon(xc);
11   copycon(xv); // expected-error{{no matching constructor}}
12 }
13 
14 class A {
15 public:
16   A(A&); // expected-note{{would lose const qualifier}} \
17          // expected-note{{no known conversion}}
18 };
19 
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}}
23 
24 short& copycon2(A a); // expected-note{{passing argument to parameter}}
25 int& copycon2(B b); // expected-note 2{{passing argument to parameter}}
26 float& copycon2(...);
27 
test_copycon2(A a,const A ac,B b,B const bc,B volatile bv)28 void test_copycon2(A a, const A ac, B b, B const bc, B volatile bv) {
29   int& i1 = copycon2(b);
30   copycon2(bc); // expected-error{{no matching constructor}}
31   copycon2(bv); // expected-error{{no matching constructor}}
32   short& s1 = copycon2(a);
33   copycon2(ac); // expected-error{{no matching constructor}}
34 }
35 
36 int& copycon3(A a); // expected-note{{passing argument to parameter 'a' here}}
37 float& copycon3(...);
38 
test_copycon3(B b,const B bc)39 void test_copycon3(B b, const B bc) {
40   int& i1 = copycon3(b);
41   copycon3(bc); // expected-error{{no matching constructor}}
42 }
43 
44 class C : public B { };
45 
46 float& copycon4(A a);
47 int& copycon4(B b);
48 
test_copycon4(C c)49 void test_copycon4(C c) {
50   int& i = copycon4(c);
51 };
52