This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH: Fix parser/typeof regression
- From: Mark Mitchell <mark at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 2 Jan 2003 10:05:28 -0800
- Subject: C++ PATCH: Fix parser/typeof regression
- Reply-to: mark at codesourcery dot com
This patch fixes the regression David reported on typeof expressions.
Tested on i686-pc-linux-gnu, applied on the mainline.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
2003-01-02 Mark Mitchell <mark@codesourcery.com>
* parser.c (cp_parser_sizeof_operand): Do not evaluate the
expression.
Index: parser.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/parser.c,v
retrieving revision 1.12
diff -c -p -r1.12 parser.c
*** parser.c 1 Jan 2003 11:58:57 -0000 1.12
--- parser.c 2 Jan 2003 18:11:34 -0000
***************
*** 1,5 ****
/* C++ Parser.
! Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
Written by Mark Mitchell <mark@codesourcery.com>.
This file is part of GCC.
--- 1,5 ----
/* C++ Parser.
! Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
Written by Mark Mitchell <mark@codesourcery.com>.
This file is part of GCC.
*************** cp_parser_sizeof_operand (parser, keywor
*** 14432,14437 ****
--- 14432,14439 ----
saved_constant_expression_p = parser->constant_expression_p;
parser->constant_expression_p = false;
+ /* Do not actually evaluate the expression. */
+ ++skip_evaluation;
/* If it's a `(', then we might be looking at the type-id
construction. */
if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_PAREN))
*************** cp_parser_sizeof_operand (parser, keywor
*** 14468,14473 ****
--- 14470,14477 ----
looking at the unary-expression production. */
if (!expr)
expr = cp_parser_unary_expression (parser, /*address_p=*/false);
+ /* Go back to evaluating expressions. */
+ --skip_evaluation;
/* Free the message we created. */
free ((char *) parser->type_definition_forbidden_message);