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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.dg/] [conversion/] [dr195-1.C] - Blame information for rev 853

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
// { dg-options "" }
2
 
3
// Copyright (C) 2004 Free Software Foundation, Inc.
4
// Contributed by Nathan Sidwell 20 Oct 2004 
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 (pv);
25
  pv = reinterpret_cast (pf);
26
 
27
  /* the following two might or might not be ok with 195.  */
28
  pf = reinterpret_cast (po);
29
  po = reinterpret_cast (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
}

powered by: WebSVN 2.1.0

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