2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
2009-12-05 06:33:25 +08:00
|
|
|
|
2010-04-13 15:45:41 +08:00
|
|
|
struct A { };
|
2011-05-11 03:08:14 +08:00
|
|
|
A::A() { } // expected-error {{definition of implicitly declared default constructor}}
|
2009-12-05 06:33:25 +08:00
|
|
|
|
2010-04-13 15:45:41 +08:00
|
|
|
struct B { };
|
2009-12-05 06:33:25 +08:00
|
|
|
B::B(const B&) { } // expected-error {{definition of implicitly declared copy constructor}}
|
|
|
|
|
2010-04-13 15:45:41 +08:00
|
|
|
struct C { };
|
2009-12-05 06:33:25 +08:00
|
|
|
C& C::operator=(const C&) { return *this; } // expected-error {{definition of implicitly declared copy assignment operator}}
|
|
|
|
|
2010-04-13 15:45:41 +08:00
|
|
|
struct D { };
|
2009-12-05 06:33:25 +08:00
|
|
|
D::~D() { } // expected-error {{definition of implicitly declared destructor}}
|
|
|
|
|
2010-04-13 01:09:20 +08:00
|
|
|
// Make sure that the special member functions are introduced for
|
|
|
|
// name-lookup purposes and overload with user-declared
|
|
|
|
// constructors and assignment operators.
|
|
|
|
namespace PR6570 {
|
|
|
|
class A { };
|
|
|
|
|
|
|
|
class B {
|
|
|
|
public:
|
|
|
|
B() {}
|
|
|
|
|
|
|
|
B(const A& a) {
|
|
|
|
operator = (CONST);
|
|
|
|
operator = (a);
|
|
|
|
}
|
|
|
|
|
|
|
|
B& operator = (const A& a) {
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
void f(const A &a) {
|
|
|
|
B b(a);
|
|
|
|
};
|
|
|
|
|
|
|
|
static const B CONST;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
2010-07-09 07:07:34 +08:00
|
|
|
|
|
|
|
namespace PR7594 {
|
|
|
|
// If the lazy declaration of special member functions is triggered
|
|
|
|
// in an out-of-line initializer, make sure the functions aren't in
|
|
|
|
// the initializer scope. This used to crash Clang:
|
|
|
|
struct C {
|
|
|
|
C();
|
|
|
|
static C *c;
|
|
|
|
};
|
|
|
|
C *C::c = new C();
|
|
|
|
}
|