comparison gcc/testsuite/g++.dg/conversion/ref2.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 // PR c++/88128 - Implement DR 330: Qualification conversions and pointers to
2 // arrays of pointers.
3
4 int *ar[4];
5 /* if at some level k the P2 is more cv-qualified than P1, then there
6 must be a const at every single level (other than level zero) of P2
7 up until k. */
8 const int *(&arp)[4] = ar; // { dg-error "discards qualifiers" }
9 const int *const(&arp2)[4] = ar;
10 int *const(&arp3)[4] = ar;
11 int *(&arp4)[4] = ar;
12
13 const int *br[4];
14 const int *(&brp)[4] = br;
15 const int *const(&brp2)[4] = br;
16 int *const(&brp3)[4] = br; // { dg-error "discards qualifiers" }
17 int *(&brp4)[4] = br; // { dg-error "discards qualifiers" }
18
19 int *c[2][3];
20 int const *const (&cp1)[3] = *c;
21 int const *(&cp2)[3] = *c; // { dg-error "discards qualifiers" }
22 int *const (&cp3)[3] = *c;
23 int *(&cp4)[3] = *c;
24
25 double *const (*d)[3];
26 double const *const (&e)[3] = *d;
27
28 int *(*f)[3];
29 const int *const (&g)[3] = *f;