This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/14459] [3.4/3.5? regression] Assignment of cast of __typeof__ of function pointer not treated as function pointer anymore.


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]