blob: 86c5fd10e23c950115f7b63f226a2b131fb78166 [file] [log] [blame]
Sean Hunt1f2f3842011-05-17 00:19:05 +00001// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
2
3void fn() = default; // expected-error {{only special member}}
4struct foo {
5 void fn() = default; // expected-error {{only special member}}
6
7 foo() = default;
8 foo(const foo&) = default;
9 foo(foo&) = default;
10 foo& operator = (const foo&) = default;
11 foo& operator = (foo&) = default;
12 ~foo() = default;
13};
14
15struct bar {
16 bar();
17 bar(const bar&);
18 bar(bar&);
19 bar& operator = (const bar&);
20 bar& operator = (bar&);
21 ~bar();
22};
23
24bar::bar() = default;
25bar::bar(const bar&) = default;
26bar::bar(bar&) = default;
27bar& bar::operator = (const bar&) = default;
28bar& bar::operator = (bar&) = default;
29bar::~bar() = default;
30
31// FIXME: static_assert(__is_trivial(foo), "foo should be trivial");
32
33static_assert(!__has_trivial_destructor(bar), "bar's destructor isn't trivial");
34static_assert(!__has_trivial_constructor(bar),
35 "bar's default constructor isn't trivial");
36static_assert(!__has_trivial_copy(bar), "bar has no trivial copy");
37static_assert(!__has_trivial_assign(bar), "bar has no trivial assign");
38
39void tester() {
40 foo f, g(f);
41 bar b, c(b);
42 f = g;
43 b = c;
44}
45