diff options
Diffstat (limited to 'test/SemaCXX/cxx0x-nontrivial-union.cpp')
-rw-r--r-- | test/SemaCXX/cxx0x-nontrivial-union.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/SemaCXX/cxx0x-nontrivial-union.cpp b/test/SemaCXX/cxx0x-nontrivial-union.cpp index 0e4add8..db296bd 100644 --- a/test/SemaCXX/cxx0x-nontrivial-union.cpp +++ b/test/SemaCXX/cxx0x-nontrivial-union.cpp @@ -122,3 +122,25 @@ namespace optional { o2 = optional<non_trivial>(); } } + +namespace pr16061 { + struct X { X(); }; + + template<typename T> struct Test1 { + union { + struct { + X x; + }; + }; + }; + + template<typename T> struct Test2 { + union { + struct { // expected-note {{default constructor of 'Test2<pr16061::X>' is implicitly deleted because variant field '' has a non-trivial default constructor}} + T x; + }; + }; + }; + + Test2<X> t2x; // expected-error {{call to implicitly-deleted default constructor of 'Test2<pr16061::X>'}} +} |