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]

warning when converting from non-const to const pointer type



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;
}
------------------------------------------------------------------------

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