Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/nontype-class37.C

raw
1 /* PR c++/94510 - nullptr_t implicitly cast to zero twice in std::array
2 { dg-do compile { target c++20 } }
3 { dg-options "-Wall" } */
4
5 struct A { char a[4]; };
6 template <A> struct B { };
7
8 constexpr const char c0{ };
9 constexpr const char c1{ 1 };
10
11 typedef B<A{ }> BA;
12 typedef B<A{ { } }> BA;
13 typedef B<A{ { 0 } }> BA;
14 typedef B<A{ { c0 } }> BA;
15 typedef B<A{ { 0, 0 } }> BA;
16 typedef B<A{ { 0, 0, 0 } }> BA;
17 typedef B<A{ { 0, 0, 0, 0 } }> BA;
18 typedef B<A{ { c0, c0, c0 } }> BA;
19 typedef B<A{ { c0, c0, c0, c0 } }> BA;
20 typedef B<A{ "" }> BA;
21 typedef B<A{ "\0" }> BA;
22 typedef B<A{ "\0\0" }> BA;
23 typedef B<A{ "\0\0\0" }> BA;
24
25 typedef B<A{ 1 }> BA1;
26 typedef B<A{ { 1 } }> BA1;
27 typedef B<A{ { 1, 0 } }> BA1;
28 typedef B<A{ { 1, 0, 0 } }> BA1;
29 typedef B<A{ { 1, 0, 0, 0 } }> BA1;
30 typedef B<A{ { c1 } }> BA1;
31 typedef B<A{ { c1, c0 } }> BA1;
32 typedef B<A{ { c1, c0, c0 } }> BA1;
33 typedef B<A{ { c1, c0, c0, c0 } }> BA1;
34 typedef B<A{ "\1" }> BA1;
35 typedef B<A{ "\1\0" }> BA1;
36 typedef B<A{ "\1\0\0" }> BA1;
37
38 typedef B<A{ 0, 1 }> BA01;
39 typedef B<A{ { 0, 1 } }> BA01;
40 typedef B<A{ { 0, 1, 0 } }> BA01;
41 typedef B<A{ { 0, 1, 0, 0 } }> BA01;
42 typedef B<A{ { c0, c1 } }> BA01;
43 typedef B<A{ { c0, c1, c0 } }> BA01;
44 typedef B<A{ { c0, c1, c0, c0 } }> BA01;
45 typedef B<A{ "\0\1" }> BA01;
46 typedef B<A{ "\0\1\0" }> BA01;
47
48
49 struct C { int a[4]; };
50 template <C> struct D { };
51
52 constexpr const int i0{ };
53
54 typedef D<C{ }> DC;
55 typedef D<C{ { } }> DC;
56 typedef D<C{ { 0 } }> DC;
57 typedef D<C{ { 0, 0 } }> DC;
58 typedef D<C{ { 0, 0, 0 } }> DC;
59 typedef D<C{ { 0, 0, 0, 0 } }> DC;
60 typedef D<C{ { i0 } }> DC;
61 typedef D<C{ { i0, i0 } }> DC;
62 typedef D<C{ { i0, i0, i0 } }> DC;
63 typedef D<C{ { i0, i0, i0, i0 } }> DC;
64
65
66 constexpr const int i1{ 1 };
67
68 typedef D<C{ 1 }> DC1;
69 typedef D<C{ { 1 } }> DC1;
70 typedef D<C{ { 1, 0 } }> DC1;
71 typedef D<C{ { 1, 0, 0 } }> DC1;
72 typedef D<C{ { 1, 0, 0, 0 } }> DC1;
73 typedef D<C{ { i1, i0, i0, i0 } }> DC1;
74
75 typedef D<C{ 0, 1 }> DC01;
76 typedef D<C{ { 0, 1 } }> DC01;
77 typedef D<C{ { 0, 1, 0 } }> DC01;
78 typedef D<C{ { 0, 1, 0, 0 } }> DC01;
79 typedef D<C{ { 0, i1, 0, 0 } }> DC01;
80 typedef D<C{ { i0, i1, i0, i0 } }> DC01; // { dg-bogus "conflicting declaration" "pr94568" }