blob: a0b822aa54ddaafde171051202d42a84874d7fdd [file] [log] [blame]
Richard Smith762bb9d2011-10-13 22:29:44 +00001// RUN: %clang_cc1 -std=c++11 %s -S -o - -emit-llvm | FileCheck %s
Richard Smith416f63e2011-09-18 12:11:43 +00002
3// PR10304: destructors should not call destructors for variant members.
4
5template<bool b = false>
6struct Foo {
7 Foo() { static_assert(b, "Foo::Foo used"); }
8 ~Foo() { static_assert(b, "Foo::~Foo used"); }
9};
10
11struct Bar {
12 Bar();
13 ~Bar();
14};
15
16union FooBar {
17 FooBar() {}
18 ~FooBar() {}
19 Foo<> foo;
20 Bar bar;
21};
22
23struct Variant {
24 Variant() {}
25 ~Variant() {}
26 union {
27 Foo<> foo;
28 Bar bar;
29 };
30};
31
32FooBar foobar;
33Variant variant;
34
35// The ctor and dtor of Foo<> and Bar should not be mentioned in the resulting
36// code.
37//
38// CHECK-NOT: 3FooILb1EEC1
39// CHECK-NOT: 3BarC1
40//
41// CHECK-NOT: 3FooILb1EED1
42// CHECK-NOT: 3BarD1