c++/7844: Function declarations parsed incorrectly

Krzysztof Parzyszek kparz@iastate.edu
Fri Sep 13 09:18:00 GMT 2002


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



More information about the Gcc-bugs mailing list