From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27973 invoked by alias); 12 Nov 2003 16:14:42 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 27953 invoked by uid 48); 12 Nov 2003 16:14:41 -0000 Date: Wed, 12 Nov 2003 16:14:00 -0000 Message-ID: <20031112161441.27951.qmail@sources.redhat.com> From: "mmitchel at gcc dot gnu dot org" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20031011162654.12581.pinskia@gcc.gnu.org> References: <20031011162654.12581.pinskia@gcc.gnu.org> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/12581] [3.4 Regression] gcc rejects typeof use for the return type X-Bugzilla-Reason: CC X-SW-Source: 2003-11/txt/msg01028.txt.bz2 List-Id: ------- Additional Comments From mmitchel at gcc dot gnu dot org 2003-11-12 16:14 ------- There are two pieces of code in this PR; comment #1 and comment #2. (1) In comment #2, GCC does not accept the code, either. That's because: typedef int (F)(); F() x; is not syntactically valid either. (3) In the example in comment #1, the problem is more complex. The "typeof" keyword, like the "sizeof" keyword, can be used in two alternative productions: sizeof type-id sizeof unary-expression In comment #1, it is the second production which is used. Note that this second production is *not* "sizeof (unary-expression)"; the unary-expression is not parenthesized. One alternative for a unary-expression is a postfix-expression. A postfix-expression can have the form "x (...)". That is the syntactic form of the line in comment #1: (Just...) (....). The parser becomes unhappy when it sees "bar::*" because "*" is not a valid identifier. (This case is analogous to "sizeof f ()" which is valid C/C++.) To try to recover from the case where the arguments to the function call are not valid would require a considerable amount of code and a slower parser. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12581