| 1 |
// { dg-options "" } |
| 2 |
|
| 3 |
// Copyright (C) 2004 Free Software Foundation, Inc. |
| 4 |
// Contributed by Nathan Sidwell 20 Oct 2004 <[email protected]> |
| 5 |
|
| 6 |
// DR 195 will allow conversions between function and object pointers |
| 7 |
// under some circumstances. It is in drafting, so we don't implement |
| 8 |
// it (yet). |
| 9 |
|
| 10 |
// this checks we are silent when not being pedantic. |
| 11 |
|
| 12 |
typedef void (*PF)(void); |
| 13 |
typedef void *PV; |
| 14 |
typedef int *PO; |
| 15 |
|
| 16 |
|
| 17 |
void foo () |
| 18 |
{ |
| 19 |
PF pf; |
| 20 |
PV pv; |
| 21 |
PO po; |
| 22 |
|
| 23 |
/* the following two will almost definitly be ok with 195. */ |
| 24 |
pf = reinterpret_cast <PF>(pv); |
| 25 |
pv = reinterpret_cast <PV>(pf); |
| 26 |
|
| 27 |
/* the following two might or might not be ok with 195. */ |
| 28 |
pf = reinterpret_cast <PF>(po); |
| 29 |
po = reinterpret_cast <PO>(pf); |
| 30 |
|
| 31 |
/* These will never be ok, as they are implicit. */ |
| 32 |
pv = pf; // { dg-error "invalid conversion" } |
| 33 |
pf = pv; // { dg-error "invalid conversion" } |
| 34 |
} |