aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp1z/variant1.C
blob: 9b18cc233caffbbba487fa41c0440ecea441b0e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// PR c++/109678
// With the bug, compiling this testcase takes more than the typical timeout.
// { dg-do compile { target c++17 } }

#include <variant>

struct A {};
struct B {};
struct C {};
struct D {};
struct E {};
struct F {};
struct G {};
struct H {};
struct I {};
struct J {};
struct K {};
struct L {};
struct M {};
struct N {};
struct O {};
struct P {};
struct Q {};
struct R {};
struct S {};
struct T {};
struct U {};
struct V {};
struct W {
    // gcc13 + compiler explorer = 20000ms 
    // gcc12.2 + compiler explorer =   400ms
    int i;
};
struct X {};
struct Y {};
struct Z {};

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>;

struct Bar {
    Foo f;
    static Bar dummy() {
        // issue is triggered by this initialization
        return {Z{}};
        // return {A{}}; // would be very quick
    }
};