This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/14459] [3.4/3.5? regression] Assignment of cast of __typeof__ of function pointer not treated as function pointer anymore.
- From: "mmitchel at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 May 2004 18:16:37 -0000
- Subject: [Bug c++/14459] [3.4/3.5? regression] Assignment of cast of __typeof__ of function pointer not treated as function pointer anymore.
- References: <20040306155720.14459.carlo@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From mmitchel at gcc dot gnu dot org 2004-05-23 18:16 -------
This is not a defect.
The GCC manual says that the syntax of "typeof" is like "sizeof". That means
that there are two operand forms, either "( type-id )" or "unary-expression".
In this case,
g(__typeof__(&foo)(foo));
the operand is not the "( type-id )" case, so it must be the "unary-expression"
case. A "postfix-expression" is a kind of "unary-expression", which means that
the "(foo)" is treated as an argument to "(&foo)". An analogous example with
"sizeof" is:
int *p;
sizeof(p)[p]
which will yield an error message, while:
(sizeof(p))[p]
will work.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14459