OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [conversion/] [dr195.C] - Blame information for rev 693

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// Copyright (C) 2004 Free Software Foundation, Inc.
2
// Contributed by Nathan Sidwell 20 Oct 2004 
3
 
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).
7
 
8
// This checks we warn when being pedantic.
9
 
10
typedef void (*PF)(void);
11
typedef void *PV;
12
typedef int *PO;
13
 
14
void foo ()
15
{
16
  PF pf;
17
  PV pv;
18
  PO po;
19
 
20
  /* the following two will almost definitly be ok with 195.  */
21
  pf = reinterpret_cast (pv); // { dg-warning "casting between" "" }
22
  pv = reinterpret_cast (pf); // { dg-warning "casting between" "" }
23
 
24
  /* the following two might or might not be ok with 195.  */
25
  pf = reinterpret_cast (po); // { dg-warning "casting between" "" }
26
  po = reinterpret_cast (pf); // { dg-warning "casting between" "" }
27
 
28
  /* These will never be ok, as they are implicit.  */
29
  pv = pf; // { dg-error "invalid conversion" "" }
30
  pf = pv; // { dg-error "invalid conversion" "" }
31
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.