This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: casting const aways shouldn't be an error even with -pedantic-errors


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]