https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106925

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I think the problem is that since r12-8066, in cxx_eval_vec_init we perform
expand_vec_init_expr while processing the default argument, at which point
start_preparsed_function hasn't yet set current_function_decl. 
expand_vec_init_expr then leads to maybe_splice_retval_cleanup which checks
DECL_CONSTRUCTOR_P (current_function_decl) without checking that
current_function_decl is non-null first.  It seems correct that
current_function_decl is null at that point, so the fix should be just:

--- a/gcc/cp/except.cc
+++ b/gcc/cp/except.cc
@@ -1327,6 +1327,7 @@ maybe_splice_retval_cleanup (tree compound_stmt)
        && current_binding_level->level_chain->kind == sk_function_parms);

   if ((function_body || current_binding_level->kind == sk_try)
+      && current_function_decl
       && !DECL_CONSTRUCTOR_P (current_function_decl)
       && !DECL_DESTRUCTOR_P (current_function_decl)
       && current_retval_sentinel)

Reply via email to