aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/class-deduction-aggr1.C
blob: f7bd72b7f45bbef1187d3954ab6c03588124a331 (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
// Testcase from P1816R0
// { dg-do compile { target c++20 } }

template <typename T>
struct S {
  T x;
  T y;
};

S s = { 1, 2 };

template <typename T>
struct C {
  S<T> s;
  T t;
};
template <typename T>
struct D {
  S<int> s;
  T t;
};
C c1 = {1, 2};			// { dg-error "" "deduction failed" }
C c2 = {1, 2, 3};		// { dg-error "" "deduction failed" }
C c3 = {{1u, 2u}, 3};		// { dg-bogus "" "OK, C<int> deduced" }
D d1 = {1, 2};			// { dg-error "" "deduction failed" }
D d2 = {1, 2, 3};	 // { dg-bogus "" "OK, braces elided, D<int> deduced" }
template <typename T>
struct I {
  using type = T;
};
template <typename T>
struct E {
  typename I<T>::type i;
  T t;
};
E e1 = {1, 2};			// { dg-bogus "" "OK, E<int> deduced" }