Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Anders Carlsson | 5c478cf | 2009-12-04 22:33:25 +0000 | [diff] [blame] | 2 | |
| 3 | struct A { }; // expected-note {{previous implicit declaration is here}} |
| 4 | A::A() { } // expected-error {{definition of implicitly declared constructor}} |
| 5 | |
| 6 | struct B { }; // expected-note {{previous implicit declaration is here}} |
| 7 | B::B(const B&) { } // expected-error {{definition of implicitly declared copy constructor}} |
| 8 | |
| 9 | struct C { }; // expected-note {{previous implicit declaration is here}} |
| 10 | C& C::operator=(const C&) { return *this; } // expected-error {{definition of implicitly declared copy assignment operator}} |
| 11 | |
| 12 | struct D { }; // expected-note {{previous implicit declaration is here}} |
| 13 | D::~D() { } // expected-error {{definition of implicitly declared destructor}} |
| 14 | |
Douglas Gregor | 6275e0c | 2010-04-12 17:09:20 +0000 | [diff] [blame] | 15 | // Make sure that the special member functions are introduced for |
| 16 | // name-lookup purposes and overload with user-declared |
| 17 | // constructors and assignment operators. |
| 18 | namespace PR6570 { |
| 19 | class A { }; |
| 20 | |
| 21 | class B { |
| 22 | public: |
| 23 | B() {} |
| 24 | |
| 25 | B(const A& a) { |
| 26 | operator = (CONST); |
| 27 | operator = (a); |
| 28 | } |
| 29 | |
| 30 | B& operator = (const A& a) { |
| 31 | return *this; |
| 32 | } |
| 33 | |
| 34 | void f(const A &a) { |
| 35 | B b(a); |
| 36 | }; |
| 37 | |
| 38 | static const B CONST; |
| 39 | }; |
| 40 | |
| 41 | } |