[Bug c++/92365] [10 Regression] ice unexpected expression ‘int16_t()’ of kind cast_expr

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Nov 5 14:40:00 GMT 2019


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
potential_constant_expression_1 handles CAST_EXPR (and *_CAST_EXPR), but
cxx_evaluate_constant_expression doesn't.
This is on a CAST_EXPR which has NULL first operand created by can_convert:
  /* implicit_conversion only considers user-defined conversions
     if it has an expression for the call argument list.  */
  if (CLASS_TYPE_P (from) || CLASS_TYPE_P (to))
    arg = build1 (CAST_EXPR, from, NULL_TREE);
In particular, NULL_TREE is considered to be a potential constant expression
and we fall through into:
      return (RECUR (TREE_OPERAND (t, 0),
                     !TYPE_REF_P (TREE_TYPE (t))));
in the CAST_EXPR: handling in potential_constant_expression_1, so return true.


More information about the Gcc-bugs mailing list