Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / g++.dg / conversion / dr195.C
blob902b871d21f5e60096b25c6d0cb1c81c4de4be9c
1 // Copyright (C) 2004 Free Software Foundation, Inc.
2 // Contributed by Nathan Sidwell 20 Oct 2004 <nathan@codesourcery.com>
4 // DR 195 will allow conversions between function and object pointers
5 // under some circumstances. It is in drafting, so we don't implement
6 // it (yet).
8 // This checks we warn when being pedantic.
10 typedef void (*PF)(void);
11 typedef void *PV;
12 typedef int *PO;
14 void foo ()
16   PF pf;
17   PV pv;
18   PO po;
20   /* the following two will almost definitly be ok with 195.  */
21   pf = reinterpret_cast <PF>(pv); // { dg-warning "casting between" "" }
22   pv = reinterpret_cast <PV>(pf); // { dg-warning "casting between" "" }
24   /* the following two might or might not be ok with 195.  */
25   pf = reinterpret_cast <PF>(po); // { dg-error "casting between" "" }
26   po = reinterpret_cast <PO>(pf); // { dg-error "casting between" "" }
28   /* These will never be ok, as they are implicit.  */
29   pv = pf; // { dg-error "invalid conversion" "" }
30   pf = pv; // { dg-error "invalid conversion" "" }