[C++ PATCH] Fix crash in stmt_expr_value_expr (PR c++/36408)

Mark Mitchell mark@codesourcery.com
Tue Jun 10 05:48:00 GMT 2008


Jakub Jelinek wrote:
> Hi!
> 
> This patch fixes the ICE part of PR36408.  ({ }) is a STMT_EXPR with
> an empty STATEMENT_LIST inside of its BIND_EXPR_BODY.  Ok for trunk/4.3?

The patch is OK.

However, I don't know what to say about this problem:

> The remaining problem is that there are no errors reported
> for the int i = ({ }); when it is in template.  That seems to be
> because of
> 128000    dgregor                       tree t = RECUR (init);
> 128000    dgregor 
> 128000    dgregor                       if (init && !t)
> 128000    dgregor                         /* If we had an initializer but it
> 128000    dgregor                            instantiated to nothing,
> 128000    dgregor                            value-initialize the object.  This will
> 128000    dgregor                            only occur when the initializer was a
> 128000    dgregor                            pack expansion where the parameter packs
> 128000    dgregor                            used in that expansion were of length
> 128000    dgregor                            zero.  */
> 128000    dgregor                         init = build_default_init (TREE_TYPE (decl),
> 128000    dgregor						     NULL_TREE);
> 128000    dgregor                       else
> 128000    dgregor                         init = t;
> in tsubst_expr.  Here init is an empty STATEMENT_LIST, for which RECUR is
> NULL.  The above code by assuming it has anything to do with parameter packs
> will zero initialize the variable, but even init = NULL wouldn't help us,
> only setting init to an empty STATEMENT_LIST or say build_empty_stmt ()
> would help.

I don't fully understand the parameter pack code.  Perhaps Doug could 
comment?

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713



More information about the Gcc-patches mailing list