Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/paren-init25.C

raw
1 // PR c++/94149 - make __is_constructible work with paren-init of aggrs.
2 // { dg-do compile { target c++20 } }
3
4 struct nonaggr {
5 nonaggr() {}
6 int i;
7 int j;
8 };
9
10 struct aggr {
11 int i;
12 int j;
13 };
14
15 static_assert(__is_constructible(aggr, int, int));
16 static_assert(__is_constructible(aggr, int));
17 static_assert(!__is_constructible(nonaggr, int, int));
18
19 using T = aggr[2];
20 static_assert(__is_constructible(T, aggr));
21 static_assert(__is_constructible(T, aggr, aggr));
22
23 using N = nonaggr[2];
24 static_assert(__is_constructible(N, nonaggr));
25 static_assert(__is_constructible(N, nonaggr, nonaggr));