Debian Codegraph @

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

raw
1 // Other testcases from P2082R1
2 // { dg-do compile { target c++20 } }
3
4 template <typename T>
5 struct X {};
6 int main() {
7 X<int> x1;
8 X x2 {x1};
9 }
10
11 template <typename T, int N>
12 struct A {
13 T array[N];
14 };
15 A a1 = {{1, 2, 3}}; // should deduce A<int, 3>
16 A a2 = {"meow"}; // should deduce A<const char, 5>
17
18 template <typename T>
19 struct B {
20 T array[2];
21 };
22 B b = {0, 1};
23
24 template<typename... T>
25 struct C : T... {};
26 C c = {
27 []{ return 1; },
28 []{ return 2; }
29 };