1 // PR c++/88128 - Implement DR 330: Qualification conversions and pointers to
2 // arrays of pointers.
3 
4 int *a[4];
5 const int *const(*ap1)[4] = &a;
6 /* if at some level k the P2 is more cv-qualified than P1, then there
7    must be a const at every single level (other than level zero) of P2
8    up until k.  */
9 const int *(*ap2)[4] = &a; // { dg-error "cannot convert" }
10 int *const(*ap3)[4] = &a;
11 int *(*ap4)[4] = &a;
12 int *(*const ap5)[4] = &a;
13 const int *const(*const ap6)[4] = &a;
14 int *const(*const ap7)[4] = &a;
15 int *(*const ap8)[4] = &a;
16 
17 const int *b[4];
18 const int *const(*bp1)[4] = &b;
19 const int *(*bp2)[4] = &b;
20 int *const(*bp3)[4] = &b; // { dg-error "cannot convert" }
21 int *(*bp4)[4] = &b; // { dg-error "cannot convert" }
22 int *(*const bp5)[4] = &b; // { dg-error "cannot convert" }
23 const int *const(*const bp6)[4] = &b;
24 int *const(*const bp7)[4] = &b; // { dg-error "cannot convert" }
25 int *(*const bp8)[4] = &b; // { dg-error "cannot convert" }
26 
27 int *c[2][3];
28 int const *const (*cp1)[3] = c;
29 int const *(*cp2)[3] = c; // { dg-error "cannot convert" }
30 int const *const (*const cp3)[3] = c;
31 int *const (*cp4)[3] = c;
32 int *(*cp5)[3] = c;
33 
34 double *const (*d)[3];
35 double const *const (*e)[3] = d;
36 int *(*f)[3];
37 const int *const (*g)[3] = f;
38 
39 // From PR88128.
40 int* (*xx)[];
41 const int* const(*yy)[] = xx;
42 
43 // From DR 330.
main()44 int main()
45 {
46    double *array2D[2][3];
47 
48    double       *       (*array2DPtr1)[3] = array2D;
49    double       * const (*array2DPtr2)[3] = array2DPtr1;
50    double const * const (*array2DPtr3)[3] = array2DPtr2;
51 }
52