[Bug c/35928] type qualifiers ignored on function return type

cnstar9988 at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Apr 14 03:49:00 GMT 2008



------- Comment #2 from cnstar9988 at gmail dot com  2008-04-14 03:49 -------
but how to applies to the pointer type and the element
the pointer is pointing to.

I don't want someone modify my pointer and the pointing to?

but the following code has no warning, why?

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

typedef struct testabc {int Class;}THANDLE;

const THANDLE* test()
{
        THANDLE *x;

        x = (THANDLE*)2;

        return x;
}

int main(int argc, char **argv)
{
     const THANDLE *p=  test();
        return (int)p;
}


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35928



More information about the Gcc-bugs mailing list