This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
warning when converting from non-const to const pointer type
- To: bug-gcc at gnu dot org
- Subject: warning when converting from non-const to const pointer type
- From: Agthorr <agthorr at barsoom dot org>
- Date: Mon, 16 Oct 2000 15:08:20 -0400
I found a case where gcc does not automatically cast from "a pointer
to non-const data" to "a pointer to const data", where the data is
otherwise of the same type. Instead, it complains that the pointers
are of incompatible pointer types.
-- Dan Stutzbach
------------------------------------------------------------------------
Reading specs from
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/specs
gcc version 2.95.2 19991024 (release)
------------------------------------------------------------------------
gcc -Wall -W -c test.i -o test
test.c: In function `main':
test.c:10: warning: passing arg 1 of `egg' from incompatible pointer type
------------------------------------------------------------------------
typedef char beep[3];
void egg (const beep *meow);
int main (void)
{
beep *meow = 0;
egg (meow);
return 0;
}
------------------------------------------------------------------------