c++/7562: strange behaviour with typedef and consts
Graham Stott
graham.stott@btinternet.com
Fri Aug 9 14:16:00 GMT 2002
The following reply was made to PR c++/7562; it has been noted by GNATS.
From: Graham Stott <graham.stott@btinternet.com>
To: Nicolas Noble <nicolas@nobis-crew.org>
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c++/7562: strange behaviour with typedef and consts
Date: Fri, 09 Aug 2002 21:56:20 +0100
Nicolas Noble wrote:
> Here is the simple source code:
>
> $ cat typedef.cc
> typedef void * voidp;
>
> void func1(const voidp p) { }
>
> void func2(const void * p) {
> func1(p);
> }
>
Not a bug.
The compiler is correct func1 takes "const ptr" where as
func2 takes a "ptr to a const" thus passing p to func1
discards the const qualifier from p.
More information about the Gcc-prs
mailing list