This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/7844: Function declarations parsed incorrectly
- From: Krzysztof Parzyszek <kparz at iastate dot edu>
- To: lerdsuwa at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, kparz at iastate dot edu, nobody at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
- Date: Fri, 13 Sep 2002 11:15:23 -0500
- Subject: Re: c++/7844: Function declarations parsed incorrectly
- Reply-to: In-Reply-To: 20020913160347 dot 2063 dot qmail at sources dot redhat dot com
On Fri, Sep 13, 2002 at 04:03:47PM -0000, lerdsuwa@gcc.gnu.org wrote:
> Synopsis: Function declarations parsed incorrectly
>
> State-Changed-Why:
> Not a bug.
> The declaration of 'foo' is parsed as
> void foo(int I)
> i.e., a function accepting an integer parameter named 'I'.
> The 'I' inside 'foo' hides the global typedef 'I'.
7 Another ambiguity arises in a parameter-declaration-clause of a func-
tion declaration, or in a type-id that is the operand of a sizeof or
typeid operator, when a type-name is nested in parentheses. In this
case, the choice is between the declaration of a parameter of type
pointer to function and the declaration of a parameter with redundant
parentheses around the declarator-id. The resolution is to consider
the type-name as a simple-type-specifier rather than a declarator-id.
[Example:
class C { };
void f(int(C)) { } // void f(int (*fp)(C c)) { }
// not: void f(int C);
--
<>> kristof@swissmail.org <Krzysztof Parzyszek> 9/2/2002
<<> "If you can't convince them, confuse them" -- HS Truman