aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp23/class-deduction-inherited6.C
blob: df8199cd3e4d25ab7e2c9e7744538b42c64ed5c9 (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
// PR c++/116276
// { dg-do compile { target c++23 } }

template<class T>
struct Base1 {
  Base1();
  Base1(T);
};

template<class T>
struct Base2 {
  Base2();
  Base2(T*);
};

template<class T = int>
struct Derived : public Base1<T>, Base2<T> {
  using Base1<T>::Base1;
  using Base2<T>::Base2;
};

using ty1 = decltype(Derived{});
using ty1 = Derived<int>;

using ty2 = decltype(Derived{true});
using ty2 = Derived<bool>;

using ty3 = decltype(Derived{(char*)nullptr});
using ty3 = Derived<char>;

template<class T = int>
struct Derived2 : public Base1<T>, Base2<T> {
  using Base1<T>::Base1;
  using Base2<T>::Base2;
  Derived2();
  Derived2(T);
};

using ty4 = decltype(Derived2{});
using ty4 = Derived2<int>;

using ty5 = decltype(Derived2{true});
using ty5 = Derived2<bool>;

using ty6 = decltype(Derived2{(char*)nullptr});
using ty6 = Derived2<char>;