This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH for c++/23357
- From: Jason Merrill <jason at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: 16 Sep 2005 02:50:06 -0400
- Subject: C++ PATCH for c++/23357
The problem in this PR was that we told the middle-end that SIZEOF_EXPR and
ALIGNOF_EXPR were unary expressions, which they are not. They have one
operand, but it isn't an expression. The middle-end code properly assumed
that any operand of a unary expression is an expression, tried to treat it
as such, and died. Fixed thus.
Tested on x86_64-pc-linux-gnu, applied to trunk. Test in
g++.dg/template/sizeof10.C.
2005-09-15 Jason Merrill <jason@redhat.com>
PR c++/23357
* cp-tree.def (SIZEOF_EXPR, ALIGNOF_EXPR): Change code class to
tcc_expression.
*** cp-tree.def.~1~ 2005-09-09 17:00:46.000000000 -0400
--- cp-tree.def 2005-09-15 14:05:51.000000000 -0400
*************** DEFTREECODE (TINST_LEVEL, "TINST_LEVEL",
*** 324,337 ****
DEFTREECODE (OFFSETOF_EXPR, "offsetof_expr", tcc_expression, 1)
/* Represents a 'sizeof' expression during template expansion. */
! DEFTREECODE (SIZEOF_EXPR, "sizeof_expr", tcc_unary, 1)
/* Represents the -> operator during template expansion. */
DEFTREECODE (ARROW_EXPR, "arrow_expr", tcc_expression, 1)
/* Represents an '__alignof__' expression during template
expansion. */
! DEFTREECODE (ALIGNOF_EXPR, "alignof_expr", tcc_unary, 1)
/* A STMT_EXPR represents a statement-expression during template
expansion. This is the GCC extension { ( ... ) }. The
--- 324,337 ----
DEFTREECODE (OFFSETOF_EXPR, "offsetof_expr", tcc_expression, 1)
/* Represents a 'sizeof' expression during template expansion. */
! DEFTREECODE (SIZEOF_EXPR, "sizeof_expr", tcc_expression, 1)
/* Represents the -> operator during template expansion. */
DEFTREECODE (ARROW_EXPR, "arrow_expr", tcc_expression, 1)
/* Represents an '__alignof__' expression during template
expansion. */
! DEFTREECODE (ALIGNOF_EXPR, "alignof_expr", tcc_expression, 1)
/* A STMT_EXPR represents a statement-expression during template
expansion. This is the GCC extension { ( ... ) }. The