Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Fariborz Jahanian | 52ab92b | 2009-08-06 17:22:51 +0000 | [diff] [blame] | 2 | |
Douglas Gregor | 90f9382 | 2009-12-22 22:17:25 +0000 | [diff] [blame] | 3 | struct S { |
| 4 | S (S); // expected-error {{copy constructor must pass its first argument by reference}} |
Fariborz Jahanian | 52ab92b | 2009-08-06 17:22:51 +0000 | [diff] [blame] | 5 | }; |
| 6 | |
| 7 | S f(); |
| 8 | |
| 9 | void g() { |
Douglas Gregor | 90f9382 | 2009-12-22 22:17:25 +0000 | [diff] [blame] | 10 | S a( f() ); |
Fariborz Jahanian | 52ab92b | 2009-08-06 17:22:51 +0000 | [diff] [blame] | 11 | } |
Douglas Gregor | fd47648 | 2009-11-13 23:59:09 +0000 | [diff] [blame] | 12 | |
Douglas Gregor | 2366cd5 | 2010-03-02 18:48:07 +0000 | [diff] [blame] | 13 | namespace PR6064 { |
| 14 | struct A { |
| 15 | A() { } |
Sean Hunt | 9ae60d5 | 2011-05-26 01:26:05 +0000 | [diff] [blame] | 16 | inline A(A&, int); // expected-note {{was not a special member function}} |
Douglas Gregor | 2366cd5 | 2010-03-02 18:48:07 +0000 | [diff] [blame] | 17 | }; |
| 18 | |
Sean Hunt | 9ae60d5 | 2011-05-26 01:26:05 +0000 | [diff] [blame] | 19 | A::A(A&, int = 0) { } // expected-warning {{makes this constructor a copy constructor}} |
Douglas Gregor | 2366cd5 | 2010-03-02 18:48:07 +0000 | [diff] [blame] | 20 | |
| 21 | void f() { |
| 22 | A const a; |
| 23 | A b(a); |
| 24 | } |
| 25 | } |