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/] [gcc.dg/] [lvalue-3.c] - Diff between revs 298 and 338

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

Rev 298 Rev 338
/* Test that assignment of a read-only variable that gets const-ness
/* Test that assignment of a read-only variable that gets const-ness
   from a read-only field is diagnosed.  */
   from a read-only field is diagnosed.  */
/* Origin: Joseph Myers <joseph@codesourcery.com> */
/* Origin: Joseph Myers <joseph@codesourcery.com> */
/* { dg-do compile } */
/* { dg-do compile } */
/* { dg-options "" } */
/* { dg-options "" } */
 
 
struct s { const int a; } x;
struct s { const int a; } x;
typeof (x.a) b;
typeof (x.a) b;
void
void
f (void)
f (void)
{
{
  x.a = 1; /* { dg-error "assignment of read-only member 'a'" } */
  x.a = 1; /* { dg-error "assignment of read-only member 'a'" } */
  b = 1; /* { dg-error "assignment of read-only variable 'b'" } */
  b = 1; /* { dg-error "assignment of read-only variable 'b'" } */
}
}
 
 

powered by: WebSVN 2.1.0

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