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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Testcase:

#include <assert.h>

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:

a.cc:5:3: error: assertion failed: i != 0
    5 |   assert(i != 0);
      |   ^~~~~~
a.cc:5:3: note: assertions must not fail when used in a constant expression 

And suppress any mention of __assert_fail, __assert_rtn etc. which are not
meant to be implementation details of assert.


This would be consistent with how we present static_assert failures:

a.cc:11:15: error: static assertion failed: blah
   11 | static_assert(false, "blah");
      |               ^~~~~

Reply via email to