C++17 adds form of static_assert without string literal.
static_assert ( bool_constexpr )
Currently clang produces diagnostics like this:
assert.cpp:1:1: error: static_assert failed static_assert(false); ^ ~~~~~ 1 error generated.
This patch adds assert expression to error message in case string literal is missing:
/Users/jkorous/assert.cpp:1:1: error: static_assert failed "false" static_assert(false); ^ ~~~~~ 1 error generated.
Reasons why printing assert expression in absence of string literal is useful are:
- Serialized diagnostics (--serialize-diagnostics) don't contain code snippet and thus error message lack context.
- No all tools scraping clang diagnostics use caret snippet provided by -f-caret-diagnostics.
This patch doesn't address message length limit as currently clang doesn't truncate messages anyway but it might be subject of another patch.
rdar://problem/38931241
Is this extra nesting necessary?