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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [cast-qual-1.c] - Blame information for rev 298

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* Incorrect `cast discards `const'' warnings.  There should be warnings
2
   in bad_cast and bad_assign; bad_assign gets the correct warning, but
3
   good_cast may get the warning instead of bad_cast.
4
   gcc 2.7.2.3 passes, egcs-1.1.2 and egcs-ss-19990428 fail.
5
   http://gcc.gnu.org/ml/gcc-bugs/1998-08/msg00645.html */
6
/* { dg-do compile } */
7
/* { dg-options "-Wcast-qual" } */
8
void
9
good_cast(const void *bar)
10
{
11
  (char *const *)bar; /* { dg-bogus "cast discards" "discarding `const' warning" } */
12
}
13
 
14
void
15
bad_cast(const void *bar)
16
{
17
  (const char **)bar; /* { dg-warning "cast discards" "discarding `const' warning" } */
18
}
19
 
20
void
21
good_assign(const void *bar)
22
{
23
  char *const *foo = bar; /* { dg-bogus "initialization discards" "discarding `const' warning" } */
24
}
25
 
26
void
27
bad_assign(const void *bar)
28
{
29
  const char **foo = bar; /* { dg-warning "initialization discards" "discarding `const' warning" } */
30
}

powered by: WebSVN 2.1.0

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