[Bug c++/113360] [13/14 Regression] Truncated constexpr error messages with -std=c++23/26

2024-03-07 Thread law at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113360

Jeffrey A. Law  changed:

   What|Removed |Added

   Priority|P3  |P2
 CC||law at gcc dot gnu.org

[Bug c++/113360] [13/14 Regression] Truncated constexpr error messages with -std=c++23/26

2024-02-01 Thread jason at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113360

Jason Merrill  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |jason at gcc dot gnu.org
 Status|NEW |ASSIGNED
 CC||jason at gcc dot gnu.org

[Bug c++/113360] [13/14 Regression] Truncated constexpr error messages with -std=c++23/26

2024-01-16 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113360

--- Comment #2 from Marek Polacek  ---
Idea: use cp_function_chain->invalid_constexpr to not to attempt to
explain_invalid_constexpr_fn.

[Bug c++/113360] [13/14 Regression] Truncated constexpr error messages with -std=c++23/26

2024-01-15 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113360

--- Comment #1 from Marek Polacek  ---
The "deducing from brace-enclosed initializer" error is emitted during parsing
from listify.  The body of init_list is not potentially-constant (due to
erroneous FOR_COND), so we register_constexpr_fundef it with result ==
error_mark_node.

require_rvalue_constant_expression in finish_static_assert thinks init_list is
potentially-constant, so we call cxx_constant_value.  new_call.fundef->result
is error_mark_node so we don't bother evaluating the body.  We call
explain_invalid_constexpr_fn but that has nothing to say, so we end up with a
missing reason.
But we already said what went wrong, so we shouldn't repeat it here anyway.

The body is:

{
  int total = 0;

  <>;
  {
int x = <<< error >>>;
<<< error >>> __for_range;
<<< error >>> __for_begin;
<<< error >>> __for_end;

<<< Unknown tree: for_stmt

  <<< error >>>
  <<< error >>>
  <>>;>>;
  <(x)) >;
   >>>;
  }
  return  = VIEW_CONVERT_EXPR(total) == 6;
}

Can be reproduced in C++20 with -Wno-invalid-constexpr.

[Bug c++/113360] [13/14 Regression] Truncated constexpr error messages with -std=c++23/26

2024-01-12 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113360

Marek Polacek  changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Last reconfirmed||2024-01-12
 Status|UNCONFIRMED |NEW

[Bug c++/113360] [13/14 Regression] Truncated constexpr error messages with -std=c++23/26

2024-01-12 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113360

Marek Polacek  changed:

   What|Removed |Added

   Target Milestone|--- |13.3
Summary|Truncated constexpr error   |[13/14 Regression]
   |messages with -std=c++23/26 |Truncated constexpr error
   ||messages with -std=c++23/26