Debian Codegraph @

gcc/testsuite/g++.dg/cpp1z/constexpr-aggr-base1.C

raw
1 // PR c++/105795
2 // { dg-do compile { target c++17 } }
3
4 struct empty
5 {};
6
7 template <typename T>
8 struct tuple_holder
9 {
10 [[no_unique_address]] T value;
11 };
12
13 struct tuple : tuple_holder<int>, tuple_holder<empty>
14 {};
15
16 constexpr auto make_tuple(int&& i, empty&& e)
17 {
18 return tuple{i, e};
19 }
20
21 constexpr int foo()
22 {
23 auto tuple = make_tuple(1, empty{});
24 return static_cast<const tuple_holder<int>&>(tuple).value;
25 }
26
27 static_assert (foo() == 1);