Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/class-deduction-aggr6.C

raw
1 // PR c++/95568
2 // { dg-do compile { target c++20 } }
3 // CTAD with aggregates containing bit-fields.
4
5 template<class, class> struct same_type;
6 template<class T> struct same_type<T, T> {};
7
8 enum E { e };
9 enum class F { f };
10
11 template<typename T>
12 struct X {
13 T a : 5;
14 };
15
16 template<typename>
17 void g()
18 {
19 auto x = X{ 0 };
20 same_type<decltype(x.a), int>();
21 auto x2 = X{ E::e };
22 same_type<decltype(x2.a), E>();
23 auto x3 = X{ false };
24 same_type<decltype(x3.a), bool>();
25 auto x4 = X{ 0u };
26 same_type<decltype(x4.a), unsigned int>();
27 auto x5 = X{ F::f };
28 same_type<decltype(x5.a), F>();
29 }
30
31 void
32 fn ()
33 {
34 g<int>();
35 }