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]

c/4832: const of typedef'ed pointers are not respected



>Number:         4832
>Category:       c
>Synopsis:       const of typedef'ed pointers are not respected
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Nov 08 02:36:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     cuenca@pacaterie.u-psud.fr
>Release:        unknown-1.0
>Organization:
>Environment:
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --host=i386-redhat-linux
Thread model: posix
gcc version 3.0.1 20010807 (Red Hat Linux 7.1 3.0-6)
>Description:
I have a typedef'ed pointer type (say: typedef void* pvoid;), when I use it
in the declaration of a function as

void bar(const pvoid a)

The compiler seems to think that bar is declared as:

void bar(pvoid a)

I can reproduce the bug with any pointer type, gcc 3.0.1 and gcc 2.96 says:

 test.c: In function `void foo (const void *)':
test.c:4: cannot convert `const void *' to `void *' for argument `1' to 
`bar (void *)'
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="test.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="test.c"

dHlwZWRlZiB2b2lkKiBwdm9pZDsKCnZvaWQgYmFyKGNvbnN0IHB2b2lkIGEpIHt9CnZvaWQgZm9v
KGNvbnN0IHZvaWQqIGEpIHsgYmFyKGEpOyB9CgppbnQgbWFpbigpCnsKCWZvbygwKTsKCXJldHVy
biAwOwp9Cg==


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