Debian Codegraph @

gcc/testsuite/g++.dg/cpp1z/variant1.C

raw
1 // PR c++/109678
2 // With the bug, compiling this testcase takes more than the typical timeout.
3 // { dg-do compile { target c++17 } }
4
5 #include <variant>
6
7 struct A {};
8 struct B {};
9 struct C {};
10 struct D {};
11 struct E {};
12 struct F {};
13 struct G {};
14 struct H {};
15 struct I {};
16 struct J {};
17 struct K {};
18 struct L {};
19 struct M {};
20 struct N {};
21 struct O {};
22 struct P {};
23 struct Q {};
24 struct R {};
25 struct S {};
26 struct T {};
27 struct U {};
28 struct V {};
29 struct W {
30 // gcc13 + compiler explorer = 20000ms
31 // gcc12.2 + compiler explorer = 400ms
32 int i;
33 };
34 struct X {};
35 struct Y {};
36 struct Z {};
37
38 using Foo = std::variant<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z>;
39
40 struct Bar {
41 Foo f;
42 static Bar dummy() {
43 // issue is triggered by this initialization
44 return {Z{}};
45 // return {A{}}; // would be very quick
46 }
47 };