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