blob: 64a7d58e19ef799285586debffeed28671aafe3c [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Fariborz Jahanian52ab92b2009-08-06 17:22:51 +00002
Douglas Gregor90f93822009-12-22 22:17:25 +00003struct S {
4 S (S); // expected-error {{copy constructor must pass its first argument by reference}}
Fariborz Jahanian52ab92b2009-08-06 17:22:51 +00005};
6
7S f();
8
9void g() {
Douglas Gregor90f93822009-12-22 22:17:25 +000010 S a( f() );
Fariborz Jahanian52ab92b2009-08-06 17:22:51 +000011}
Douglas Gregorfd476482009-11-13 23:59:09 +000012
Douglas Gregor2366cd52010-03-02 18:48:07 +000013namespace PR6064 {
14 struct A {
15 A() { }
Sean Hunt9ae60d52011-05-26 01:26:05 +000016 inline A(A&, int); // expected-note {{was not a special member function}}
Douglas Gregor2366cd52010-03-02 18:48:07 +000017 };
18
Sean Hunt9ae60d52011-05-26 01:26:05 +000019 A::A(A&, int = 0) { } // expected-warning {{makes this constructor a copy constructor}}
Douglas Gregor2366cd52010-03-02 18:48:07 +000020
21 void f() {
22 A const a;
23 A b(a);
24 }
25}