public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/7844: Function declarations parsed incorrectly
@ 2002-09-13 9:26 Krzysztof Parzyszek
0 siblings, 0 replies; 3+ messages in thread
From: Krzysztof Parzyszek @ 2002-09-13 9:26 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c++/7844; it has been noted by GNATS.
From: Krzysztof Parzyszek <kparz@iastate.edu>
To: lerdsuwa@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
kparz@iastate.edu, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Cc:
Subject: Re: c++/7844: Function declarations parsed incorrectly
Date: Fri, 13 Sep 2002 11:15:23 -0500
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: c++/7844: Function declarations parsed incorrectly
@ 2002-09-13 9:03 lerdsuwa
0 siblings, 0 replies; 3+ messages in thread
From: lerdsuwa @ 2002-09-13 9:03 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, kparz, nobody
Synopsis: Function declarations parsed incorrectly
State-Changed-From-To: open->closed
State-Changed-By: lerdsuwa
State-Changed-When: Fri Sep 13 09:03:45 2002
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'.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7844
^ permalink raw reply [flat|nested] 3+ messages in thread
* c++/7844: Function declarations parsed incorrectly
@ 2002-09-05 15:36 kparz
0 siblings, 0 replies; 3+ messages in thread
From: kparz @ 2002-09-05 15:36 UTC (permalink / raw)
To: gcc-gnats
>Number: 7844
>Category: c++
>Synopsis: Function declarations parsed incorrectly
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Thu Sep 05 15:36:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: kparz
>Release: 3.3 20020905 (experimental)
>Organization:
>Environment:
System: FreeBSD arcturus.student.iastate.edu 4.6-STABLE FreeBSD 4.6-STABLE #15: Sat Aug 24 23:25:48 CDT 2002 kparz@arcturus.student.iastate.edu:/usr/obj/usr/src/sys/ARCTURUS i386
host: i386-unknown-freebsd4.6
build: i386-unknown-freebsd4.6
target: i386-unknown-freebsd4.6
configured with: ../gcc/configure --prefix=/u/gcc-20020905 --enable-languages=c,c++,f77
>Description:
Ambiguity in function declarations is resolved incorrectly.
See ISO/IEC 14882:1998(E), 8.2 p7
>How-To-Repeat:
# 1 "parse.cc"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "parse.cc"
typedef int I;
void foo(int(I));
void (*bar)(int (*)(int)) = &foo;
>Fix:
Use the other style of function declarators (with *), i.e.
void foo(int (*)(I));
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-09-13 16:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-13 9:26 c++/7844: Function declarations parsed incorrectly Krzysztof Parzyszek
-- strict thread matches above, loose matches on Subject: below --
2002-09-13 9:03 lerdsuwa
2002-09-05 15:36 kparz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).