blob: 2bf7056521b7f819fdaffc065f02fc7a3a53c39b [file] [log] [blame]
Richard Smith762bb9d2011-10-13 22:29:44 +00001// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
Sean Huntcf34e752011-05-16 22:41:40 +00002
3struct non_trivial {
4 non_trivial();
5 non_trivial(const non_trivial&);
6 non_trivial& operator = (const non_trivial&);
7 ~non_trivial();
8};
9
10union u {
11 non_trivial nt;
12};
13
Richard Smithb9c64d82012-02-16 20:41:22 +000014union static_data_member {
15 static int i;
16};
17int static_data_member::i;
18
Sean Huntcf34e752011-05-16 22:41:40 +000019union bad {
Richard Smithb9c64d82012-02-16 20:41:22 +000020 int &i; // expected-error {{union member 'i' has reference type 'int &'}}
Sean Huntcf34e752011-05-16 22:41:40 +000021};
22
23struct s {
24 union {
25 non_trivial nt;
26 };
27};