[Bug c++/119497] Improve diagnostic for failed assert(expr) in constexpr context

2025-03-28 Thread tom at honermann dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119497 Tom Honermann changed: What|Removed |Added CC||tom at honermann dot net --- Comment #1

[Bug c++/119497] Improve diagnostic for failed assert(expr) in constexpr context

2025-03-28 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119497 --- Comment #9 from Jonathan Wakely --- There's no reason to have any special case for scenario 1. It should give the same diagnostic as any other invalid use of a non-constant in constexpr contexts.

[Bug c++/119497] Improve diagnostic for failed assert(expr) in constexpr context

2025-03-28 Thread thomaspkhealy at yahoo dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119497 Thomas P. K. Healy changed: What|Removed |Added CC||thomaspkhealy at yahoo dot com ---

[Bug c++/119497] Improve diagnostic for failed assert(expr) in constexpr context

2025-03-27 Thread arthur.j.odwyer at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119497 --- Comment #7 from Arthur O'Dwyer --- > @jwakely is correct that on OSX/Darwin the macro is named `__assert_rtn`. ...er, sorry, the *non-constexpr function called by the `assert` macro* is named `__assert_rtn`.

[Bug c++/119497] Improve diagnostic for failed assert(expr) in constexpr context

2025-03-27 Thread arthur.j.odwyer at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119497 Arthur O'Dwyer changed: What|Removed |Added CC||arthur.j.odwyer at gmail dot com ---

[Bug c++/119497] Improve diagnostic for failed assert(expr) in constexpr context

2025-03-27 Thread thiago at kde dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119497 Thiago Macieira changed: What|Removed |Added CC||thiago at kde dot org --- Comment #4

[Bug c++/119497] Improve diagnostic for failed assert(expr) in constexpr context

2025-03-27 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119497 --- Comment #5 from Jonathan Wakely --- I guess calling any noreturn function inside the expansion of a macro called 'assert' is probably a good enough heuristic.

[Bug c++/119497] Improve diagnostic for failed assert(expr) in constexpr context

2025-03-27 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119497 --- Comment #1 from Jonathan Wakely --- (In reply to Jonathan Wakely from comment #0) > Another way to word it could be: > > note: failed assertion is not a constant expression: '...' Actually maybe not this, because it might lead people to th

[Bug c++/119497] Improve diagnostic for failed assert(expr) in constexpr context

2025-03-27 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119497 --- Comment #3 from Jonathan Wakely --- (In reply to Jonathan Wakely from comment #2) > And suppress any mention of __assert_fail, __assert_rtn etc. which are not s/which are not/which are/ > meant to be implementation details of assert.

[Bug c++/119497] Improve diagnostic for failed assert(expr) in constexpr context

2025-03-27 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119497 --- Comment #2 from Jonathan Wakely --- Testcase: #include constexpr int foo(int i) { assert(i != 0); return 1; } constexpr int i = foo(0); We do already show the assert(...) macro in the caret diagnostic, so maybe this would be clear: