1 | // RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors |
2 | // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors |
3 | // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors |
4 | // RUN: %clang_cc1 -std=c++1z -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors |
5 | |
6 | #if __cplusplus < 201103L |
7 | // expected-error@+1 {{variadic macro}} |
8 | #define static_assert(...) __extension__ _Static_assert(__VA_ARGS__) |
9 | #endif |
10 | |
11 | namespace dr2120 { // dr2120: 7 |
12 | struct A {}; |
13 | struct B : A {}; |
14 | struct C { A a; }; |
15 | struct D { C c[5]; }; |
16 | struct E : B { D d; }; |
17 | static_assert(__is_standard_layout(B), ""); |
18 | static_assert(__is_standard_layout(D), ""); |
19 | static_assert(!__is_standard_layout(E), ""); |
20 | } |
21 | |
22 | namespace dr2180 { // dr2180: yes |
23 | class A { |
24 | A &operator=(const A &); // expected-note 0-2{{here}} |
25 | A &operator=(A &&); // expected-note 0-2{{here}} expected-error 0-1{{extension}} |
26 | }; |
27 | |
28 | struct B : virtual A { |
29 | B &operator=(const B &); |
30 | B &operator=(B &&); // expected-error 0-1{{extension}} |
31 | virtual void foo() = 0; |
32 | }; |
33 | #if __cplusplus < 201103L |
34 | B &B::operator=(const B&) = default; // expected-error {{private member}} expected-error {{extension}} expected-note {{here}} |
35 | B &B::operator=(B&&) = default; // expected-error {{private member}} expected-error 2{{extension}} expected-note {{here}} |
36 | #else |
37 | B &B::operator=(const B&) = default; // expected-error {{would delete}} expected-note@-9{{inaccessible copy assignment}} |
38 | B &B::operator=(B&&) = default; // expected-error {{would delete}} expected-note@-10{{inaccessible move assignment}} |
39 | #endif |
40 | } |
41 | |