Sean Hunt | 1f2f384 | 2011-05-17 00:19:05 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s |
| 2 | |
| 3 | struct non_trivial { |
| 4 | non_trivial(); |
| 5 | non_trivial(const non_trivial&); |
| 6 | non_trivial& operator = (const non_trivial&); |
| 7 | ~non_trivial(); |
| 8 | }; |
| 9 | |
| 10 | union bad_union { // expected-note {{marked deleted here}} |
| 11 | non_trivial nt; |
| 12 | }; |
| 13 | bad_union u; // expected-error {{call to deleted constructor}} |
| 14 | union bad_union2 { // expected-note {{marked deleted here}} |
| 15 | const int i; |
| 16 | }; |
| 17 | bad_union2 u2; // expected-error {{call to deleted constructor}} |
| 18 | |
| 19 | struct bad_anon { // expected-note {{marked deleted here}} |
| 20 | union { |
| 21 | non_trivial nt; |
| 22 | }; |
| 23 | }; |
| 24 | bad_anon a; // expected-error {{call to deleted constructor}} |
| 25 | struct bad_anon2 { // expected-note {{marked deleted here}} |
| 26 | union { |
| 27 | const int i; |
| 28 | }; |
| 29 | }; |
| 30 | bad_anon2 a2; // expected-error {{call to deleted constructor}} |
| 31 | |
| 32 | // This would be great except that we implement |
| 33 | union good_union { |
| 34 | const int i; |
| 35 | float f; |
| 36 | }; |
| 37 | good_union gu; |
| 38 | struct good_anon { |
| 39 | union { |
| 40 | const int i; |
| 41 | float f; |
| 42 | }; |
| 43 | }; |
| 44 | good_anon ga; |
| 45 | |
| 46 | struct good : non_trivial { |
| 47 | non_trivial nt; |
| 48 | }; |
| 49 | good g; |