2011-10-14 06:29:44 +08:00
|
|
|
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
|
2011-05-17 06:41:40 +08:00
|
|
|
|
|
|
|
struct non_trivial {
|
|
|
|
non_trivial();
|
|
|
|
non_trivial(const non_trivial&);
|
|
|
|
non_trivial& operator = (const non_trivial&);
|
|
|
|
~non_trivial();
|
|
|
|
};
|
|
|
|
|
|
|
|
union u {
|
|
|
|
non_trivial nt;
|
|
|
|
};
|
|
|
|
|
2012-02-17 04:41:22 +08:00
|
|
|
union static_data_member {
|
|
|
|
static int i;
|
|
|
|
};
|
|
|
|
int static_data_member::i;
|
|
|
|
|
2011-05-17 06:41:40 +08:00
|
|
|
union bad {
|
2012-02-17 04:41:22 +08:00
|
|
|
int &i; // expected-error {{union member 'i' has reference type 'int &'}}
|
2011-05-17 06:41:40 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct s {
|
|
|
|
union {
|
|
|
|
non_trivial nt;
|
|
|
|
};
|
|
|
|
};
|
2012-02-26 18:50:32 +08:00
|
|
|
|
|
|
|
// Don't crash on this.
|
|
|
|
struct TemplateCtor { template<typename T> TemplateCtor(T); };
|
|
|
|
union TemplateCtorMember { TemplateCtor s; };
|