Debian Codegraph @

gcc/testsuite/g++.dg/cpp23/class-deduction-inherited6.C

raw
1 // PR c++/116276
2 // { dg-do compile { target c++23 } }
3
4 template<class T>
5 struct Base1 {
6 Base1();
7 Base1(T);
8 };
9
10 template<class T>
11 struct Base2 {
12 Base2();
13 Base2(T*);
14 };
15
16 template<class T = int>
17 struct Derived : public Base1<T>, Base2<T> {
18 using Base1<T>::Base1;
19 using Base2<T>::Base2;
20 };
21
22 using ty1 = decltype(Derived{});
23 using ty1 = Derived<int>;
24
25 using ty2 = decltype(Derived{true});
26 using ty2 = Derived<bool>;
27
28 using ty3 = decltype(Derived{(char*)nullptr});
29 using ty3 = Derived<char>;
30
31 template<class T = int>
32 struct Derived2 : public Base1<T>, Base2<T> {
33 using Base1<T>::Base1;
34 using Base2<T>::Base2;
35 Derived2();
36 Derived2(T);
37 };
38
39 using ty4 = decltype(Derived2{});
40 using ty4 = Derived2<int>;
41
42 using ty5 = decltype(Derived2{true});
43 using ty5 = Derived2<bool>;
44
45 using ty6 = decltype(Derived2{(char*)nullptr});
46 using ty6 = Derived2<char>;