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

David Malcolm <dmalcolm at gcc dot gnu.org> changed:

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

--- Comment #3 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
It's a failing assertion:

15401             gcc_assert (cp_unevaluated_operand != 0);

within tsubst_copy's PARM_DECL handling of a "this" PARM_DECL:

(gdb) p t
$2 = <parm_decl 0x7ffff18d7380 this>

15389       case PARM_DECL:
15390         r = retrieve_local_specialization (t);
15391   
15392         if (r == NULL_TREE)
15393           {
15394             /* We get here for a use of 'this' in an NSDMI.  */
15395             if (DECL_NAME (t) == this_identifier && current_class_ptr)
15396               return current_class_ptr;
15397   
15398             /* This can happen for a parameter name used later in a
function
15399                declaration (such as in a late-specified return type). 
Just
15400                make a dummy decl, since it's only used for its type.  */
15401             gcc_assert (cp_unevaluated_operand != 0);
15402             r = tsubst_decl (t, args, complain);

where the local specialization is NULL.

The PARM_DECL in question is created by the hunk from r266224, which is calling
inject_this_parameter for the "noexcept" fn, in
cp_parser_noexcept_specification_opt

25032             if (current_class_type)
25033               inject_this_parameter (current_class_type,
TYPE_UNQUALIFIED);

This sets current_class_ptr to the "this" PARM_DECL.

It then resets current_class_ptr back to NULL here:

25055             current_class_ptr = save_ccp;

Later, in tsubst_copy on the PARM_DECL in the code quoted above, the PARM_DECL
matches only part of the test here:

15395             if (DECL_NAME (t) == this_identifier && current_class_ptr)
15396               return current_class_ptr;

in that it's DECL_NAME is indeed this_identifier, but current_class_ptr is
NULL, and so we carry on to the assertion:

15401             gcc_assert (cp_unevaluated_operand != 0);

which fails.

Reply via email to