| 1 |
// { dg-do assemble } |
| 2 |
|
| 3 |
// Copyright (C) 2000 Free Software Foundation, Inc. |
| 4 |
// Contributed by Nathan Sidwell 4 Feb 2000 <[email protected]> |
| 5 |
|
| 6 |
// Array of cv T decays to pointer to cv T, and pointer to array of cv T can |
| 7 |
// be converted to pointer to cv T. We need to make sure the `cv's don't |
| 8 |
// confuse us. |
| 9 |
|
| 10 |
typedef char const *ary_t[2]; |
| 11 |
|
| 12 |
void f0 (ary_t const *const &ary) |
| 13 |
{ |
| 14 |
static_cast <void const *> (ary); |
| 15 |
static_cast <void *> (ary); // { dg-error "" } casts away const |
| 16 |
(void const *) (ary); |
| 17 |
} |
| 18 |
|
| 19 |
void f1 (ary_t *const &ary) |
| 20 |
{ |
| 21 |
static_cast <void *> (ary); |
| 22 |
static_cast <void const *> (ary); |
| 23 |
(void const *) (ary); |
| 24 |
} |
| 25 |
|
| 26 |
void f2 (ary_t const *&ary) |
| 27 |
{ |
| 28 |
static_cast <void const *> (ary); |
| 29 |
static_cast <void *> (ary); // { dg-error "" } casts away const |
| 30 |
(void const *) (ary); |
| 31 |
} |
| 32 |
|
| 33 |
void f3 (ary_t *&ary) |
| 34 |
{ |
| 35 |
static_cast <void *> (ary); |
| 36 |
static_cast <void const *> (ary); |
| 37 |
(void const *) (ary); |
| 38 |
} |