]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/gcc.dg/cast-qual-1.c
replace ISL with isl
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / cast-qual-1.c
CommitLineData
4014b382
JM
1/* 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.
54d7ee59 5 http://gcc.gnu.org/ml/gcc-bugs/1998-08/msg00645.html */
4014b382
JM
6/* { dg-do compile } */
7/* { dg-options "-Wcast-qual" } */
8void
9good_cast(const void *bar)
10{
11 (char *const *)bar; /* { dg-bogus "cast discards" "discarding `const' warning" } */
12}
13
14void
15bad_cast(const void *bar)
16{
17 (const char **)bar; /* { dg-warning "cast discards" "discarding `const' warning" } */
18}
19
20void
21good_assign(const void *bar)
22{
edf50130 23 char *const *foo = bar; /* { dg-bogus "initialization discards" "discarding `const' warning" } */
4014b382
JM
24}
25
26void
27bad_assign(const void *bar)
28{
29 const char **foo = bar; /* { dg-warning "initialization discards" "discarding `const' warning" } */
30}