For
static constexpr m = 10; static_assert(m == 11);
the output is before:
./test.cpp:2:1: error: static_assert failed due to requirement 'm == 11' static_assert(m == 11); ^ ~~~~~~~ 1 error generated.
and after:
./test.cpp:2:1: error: static assertion failed due to requirement 'm == 11' static_assert(m == 11); ^ ~~~~~~~ ./test.cpp:2:15: note: left-hand side of operator '==' evaluates to '10' static_assert(m == 11); ^ 1 error generated.
The patch adds a new function Sema::DiagnoseStaticAssertDetails(), which currently only handles binary operators with an integer literal on one side and a non-integer literal on the other side. This is intentionally kept simple, but can be improved incrementally over time of course.
Should probably add at least one test that shows the "right-hand" version of the diagnostic.