This is the mail archive of the gcc@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: Missing warning message


Andrew Vaught wrote:
> 
> While working on g95, we had an erroneous declaration that looked like:
> 
> char array[] = { "a", "b", "c" };
> 
> Compiling with '-Wall -pedantic' gave no warnings of any sort.  Gcc missed
> the fact that the array elements are characters while the initialization
> elements are pointers to character.  gcc -v gives:
> 
> Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
> gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)

This fails to compile with my g++, as I would have hoped.

g++     cinout.C   -o cinout
cinout.C: In function `int main()':
cinout.C:4: cannot convert `const char*' to `char' in initialization

Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.97/specs
Configured with: ../gcc-20010122/configure
--srcdir=/usr/local/src/gcc/gcc-20010122
gcc version 2.97 20010122 (experimental)

-- James Dennett


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