On 11/7/05, Inder <[EMAIL PROTECTED]> wrote: > Hi all, > I am compiling small program on a SPARC gcc 3.4.3 > > test.c > ------------------------------------------------------- > > struct test1 > { > int a; > int b; > char c; > }; > > struct test2 > { > char a; > char b; > char c; > }; > > struct test3 > { > int a; > int b; > int c; > }; > > int main() > { > struct test1* t1, t11; > struct test2* t2 ; > struct test3* t3; > > t1 = &t11; > t2 = (struct t2*)t1; > t3 = (struct t3*)t1; > return 0; > } > -------------------------------------------------------- > > I suppose such an assignment should give a warning > "incompatible pointer type" but when compiling with > gcc 3.4.3 no such warning is given even with -Wall enabled. > > Is this a bug in this version?
First of all, this list is for development of gcc, not with gcc. Use [EMAIL PROTECTED] for such questions. Second, you are assigning a pointer of type (struct t2*) to a pointer of type (struct t2*). This is of course fine - if you remove the cast, you get the warning you want. This is just like f.i. double x = (int)i. Richard.