This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: casting const aways shouldn't be an error even with -pedantic-errors
- To: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Subject: Re: casting const aways shouldn't be an error even with -pedantic-errors
- From: scott douglass <sdouglass at arm dot com>
- Date: Mon, 06 Mar 2000 08:33:03 +0000
- Cc: gcc-bugs at gcc dot gnu dot org
- References: <4.2.0.58.19991125150800.00b1ac70@mail1><4.2.0.58.19991125150800.00b1ac70@mail1>
At 12:03 PM 3/5/00 +0100, Martin v. Loewis wrote:
> > The following code gives an error with -pedantic-errors -Wconst-qual. It
> > should only be a warning.
>
>Thanks for your bug report. I cannot reproduce this bug with either
>1.1.2, or 2.95.2; I always get a warning only. Your report was
>somewhat confusing (e.g. -Wconst-qual is not an option), so perhaps I
>was trying the wrong test case.
My apologies: when I wrote '-Wconst-qual' I should have written '-Wcast-qual'. Please let me try again:
int *f(const int *p) { return (int*)p; } /* (errror) cast discards `const' from pointer target type */
The proper command line is:
gcc -c -Wcast-qual -pedantic-errors bug.c
I believe that the error should only be a warning even with '-pedantic-errors'.
gcc -v produces:
Reading specs from /eda/tools/gnu/tools/gcc-2.95.2/sunos5.7/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/specs
gcc version 2.95.2 19991024 (release)
Thanks.