| 1 |
// PR c++/91364 - P0388R4: Permit conversions to arrays of unknown bound. |
| 2 |
// { dg-do compile { target c++20 } } |
| 3 |
|
| 4 |
// As conversion/qual1.C, but with []. |
| 5 |
|
| 6 |
int *a[4]; |
| 7 |
const int *const(*ap1)[] = &a; |
| 8 |
/* if at some level k the P2 is more cv-qualified than P1, then there |
| 9 |
must be a const at every single level (other than level zero) of P2 |
| 10 |
up until k. */ |
| 11 |
const int *(*ap2)[] = &a; // { dg-error "cannot convert" } |
| 12 |
int *const(*ap3)[] = &a; |
| 13 |
int *(*ap4)[] = &a; |
| 14 |
int *(*const ap5)[] = &a; |
| 15 |
const int *const(*const ap6)[] = &a; |
| 16 |
int *const(*const ap7)[] = &a; |
| 17 |
int *(*const ap8)[] = &a; |
| 18 |
|
| 19 |
const int *b[4]; |
| 20 |
const int *const(*bp1)[] = &b; |
| 21 |
const int *(*bp2)[] = &b; |
| 22 |
int *const(*bp3)[] = &b; // { dg-error "cannot convert" } |
| 23 |
int *(*bp4)[] = &b; // { dg-error "cannot convert" } |
| 24 |
int *(*const bp5)[] = &b; // { dg-error "cannot convert" } |
| 25 |
const int *const(*const bp6)[] = &b; |
| 26 |
int *const(*const bp7)[] = &b; // { dg-error "cannot convert" } |
| 27 |
int *(*const bp8)[] = &b; // { dg-error "cannot convert" } |
| 28 |
|
| 29 |
int *c[2][3]; |
| 30 |
int const *const (*cp1)[] = c; |
| 31 |
int const *(*cp2)[] = c; // { dg-error "cannot convert" } |
| 32 |
int const *const (*const cp3)[] = c; |
| 33 |
int *const (*cp4)[] = c; |
| 34 |
int *(*cp5)[] = c; |
| 35 |
|
| 36 |
double *const (*d)[3]; |
| 37 |
double const *const (*e)[] = d; |
| 38 |
int *(*f)[3]; |
| 39 |
const int *const (*g)[] = f; |