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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.other/] [cast3.C] - Diff between revs 305 and 338

Only display areas with differences | Details | Blame | View Log

Rev 305 Rev 338
// { dg-do assemble  }
// { dg-do assemble  }
// Copyright (C) 1999 Free Software Foundation, Inc.
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 12 Dec 1999 
// Contributed by Nathan Sidwell 12 Dec 1999 
// static_cast should not cast _away_ constness ([expr.static.cast]/6),
// static_cast should not cast _away_ constness ([expr.static.cast]/6),
// but nothing bans _adding_ constness. [expr.static.cast]/10 states that a
// but nothing bans _adding_ constness. [expr.static.cast]/10 states that a
// pointer of type cv void can be cast to pointer to object type.
// pointer of type cv void can be cast to pointer to object type.
struct X;
struct X;
struct Y {};
struct Y {};
struct Z : Y {};
struct Z : Y {};
void fn (void *p, void const *cp, Y *yp, Y const *ycp, Z *zp, Z const *zcp)
void fn (void *p, void const *cp, Y *yp, Y const *ycp, Z *zp, Z const *zcp)
{
{
  static_cast  (p);
  static_cast  (p);
  static_cast  (p);
  static_cast  (p);
  static_cast  (p);
  static_cast  (p);
  static_cast  (p);
  static_cast  (p);
  static_cast  (p);
  static_cast  (p);
  static_cast  (p);
  static_cast  (p);
  static_cast  (p);
  static_cast  (p);
  static_cast  (p);
  static_cast  (p);
  static_cast  (cp);           // { dg-error "" } lose const
  static_cast  (cp);           // { dg-error "" } lose const
  static_cast  (cp);
  static_cast  (cp);
  static_cast  (cp);         // { dg-error "" } lose const
  static_cast  (cp);         // { dg-error "" } lose const
  static_cast  (cp);
  static_cast  (cp);
  static_cast  (cp);        // { dg-error "" } lose const
  static_cast  (cp);        // { dg-error "" } lose const
  static_cast  (cp);  // { dg-error "" } lose const
  static_cast  (cp);  // { dg-error "" } lose const
  static_cast  (cp);
  static_cast  (cp);
  static_cast  (cp);
  static_cast  (cp);
  static_cast  (yp);
  static_cast  (yp);
  static_cast  (yp);
  static_cast  (yp);
  static_cast  (ycp);          // { dg-error "" } lose const
  static_cast  (ycp);          // { dg-error "" } lose const
  static_cast  (ycp);
  static_cast  (ycp);
  static_cast  (zp);
  static_cast  (zp);
  static_cast  (zp);
  static_cast  (zp);
  static_cast  (zcp);          // { dg-error "" } lose const
  static_cast  (zcp);          // { dg-error "" } lose const
  static_cast  (zcp);
  static_cast  (zcp);
}
}
 
 

powered by: WebSVN 2.1.0

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