1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 
3 struct S {
4    S (S);  // expected-error {{copy constructor must pass its first argument by reference}}
5 };
6 
7 S f();
8 
g()9 void g() {
10   S a( f() );
11 }
12 
13 class foo {
14   foo(foo&, int); // expected-note {{previous}}
15   foo(int); // expected-note {{previous}}
16   foo(const foo&); // expected-note {{previous}}
17 };
18 
foo(foo &,int=0)19 foo::foo(foo&, int = 0) { } // expected-error {{makes this constructor a copy constructor}}
foo(int=0)20 foo::foo(int = 0) { } // expected-error {{makes this constructor a default constructor}}
foo(const foo &=0)21 foo::foo(const foo& = 0) { } //expected-error {{makes this constructor a default constructor}}
22 
23 namespace PR6064 {
24   struct A {
APR6064::A25     A() { }
26     inline A(A&, int); // expected-note {{previous}}
27   };
28 
A(A &,int=0)29   A::A(A&, int = 0) { } // expected-error {{makes this constructor a copy constructor}}
30 
f()31   void f() {
32     A const a;
33     A b(a);
34   }
35 }
36 
37 namespace PR10618 {
38   struct A {
39     A(int, int, int); // expected-note {{previous}}
40   };
A(int a=0,int b=0,int c=0)41   A::A(int a = 0, // expected-error {{makes this constructor a default constructor}}
42        int b = 0,
43        int c = 0) {}
44 
45   struct B {
46     B(int);
47     B(const B&, int); // expected-note {{previous}}
48   };
B(const B &=B (0),int=0)49   B::B(const B& = B(0), // expected-error {{makes this constructor a default constructor}}
50        int = 0) {
51   }
52 
53   struct C {
54     C(const C&, int); // expected-note {{previous}}
55   };
C(const C &,int=0)56   C::C(const C&,
57        int = 0) { // expected-error {{makes this constructor a copy constructor}}
58   }
59 }
60