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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.old-deja/] [g++.other/] [cast3.C] - Blame information for rev 749

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

Line No. Rev Author Line
1 699 jeremybenn
// { dg-do assemble  }
2
// Copyright (C) 1999 Free Software Foundation, Inc.
3
// Contributed by Nathan Sidwell 12 Dec 1999 
4
 
5
// static_cast should not cast _away_ constness ([expr.static.cast]/6),
6
// but nothing bans _adding_ constness. [expr.static.cast]/10 states that a
7
// pointer of type cv void can be cast to pointer to object type.
8
 
9
struct X;
10
struct Y {};
11
struct Z : Y {};
12
 
13
void fn (void *p, void const *cp, Y *yp, Y const *ycp, Z *zp, Z const *zcp)
14
{
15
  static_cast  (p);
16
  static_cast  (p);
17
  static_cast  (p);
18
  static_cast  (p);
19
  static_cast  (p);
20
  static_cast  (p);
21
  static_cast  (p);
22
  static_cast  (p);
23
 
24
  static_cast  (cp);           // { dg-error "" } lose const
25
  static_cast  (cp);
26
  static_cast  (cp);         // { dg-error "" } lose const
27
  static_cast  (cp);
28
  static_cast  (cp);        // { dg-error "" } lose const
29
  static_cast  (cp);  // { dg-error "" } lose const
30
  static_cast  (cp);
31
  static_cast  (cp);
32
 
33
  static_cast  (yp);
34
  static_cast  (yp);
35
 
36
  static_cast  (ycp);          // { dg-error "" } lose const
37
  static_cast  (ycp);
38
 
39
  static_cast  (zp);
40
  static_cast  (zp);
41
 
42
  static_cast  (zcp);          // { dg-error "" } lose const
43
  static_cast  (zcp);
44
}

powered by: WebSVN 2.1.0

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