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

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

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

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Regarding the bad diagnostics, we do:
  if (processing_template_decl)
    refl = fold_non_dependent_expr (refl, tf_warning_or_error, true);
  else
    refl = cxx_constant_value (refl);
  if (refl == error_mark_node)
    {
      gcc_checking_assert (seen_error ());
      return error_mark_node;
    }
  location_t loc = cp_expr_loc_or_input_loc (refl);
  if (!REFLECT_EXPR_P (refl))
    {
      error_at (loc, "splice argument must be an "
                "expression of type %qs", "std::meta::info");
      return error_mark_node;
    }
and fold_non_dependent_expr allows non-constant, so it is ctx->quiet
evaluation, so doesn't complain about the exception being thrown and not
caught, just returns the original argument (i.e. says it is not constant).
The error message is weird, I guess it should be done only if refl doesn't have
REFLECT_TYPE_P (TREE_TYPE (refl)).  If it does, I wonder if in the
!processing_template_decl case it is even possible to have !REFLECT_EXPR_P, but
for the processing_template_decl case either we should return build_nt
(SPLICE_EXPR, orig_refl); or emit a different error that the operand is not a
constant expression (but we unfortunately don't have the details why).

Reply via email to