Debian Codegraph @

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

raw
1 // PR c++/94149 - make __is_constructible work with paren-init of aggrs.
2 // { dg-do compile { target c++20 } }
3
4 #include <type_traits>
5
6 int main()
7 {
8 using T = int[1];
9 T t(1);
10
11 static_assert(__is_constructible(T, int));
12 static_assert(!__is_constructible(T, int, int));
13 static_assert(std::is_constructible_v<T, int>);
14 static_assert(std::is_nothrow_constructible_v<T, int>);
15
16 using T2 = int[2];
17 T2 t2(1);
18 T2 t3(1, 2);
19
20 static_assert(__is_constructible(T2, int));
21 static_assert(__is_constructible(T2, int, int));
22 static_assert(std::is_constructible_v<T2, int, int>);
23 static_assert(std::is_nothrow_constructible_v<T2, int, int>);
24 }