| 1 |
.. title:: clang-tidy - modernize-unary-static-assert |
| 2 |
|
| 3 |
modernize-unary-static-assert |
| 4 |
============================= |
| 5 |
|
| 6 |
The check diagnoses any ``static_assert`` declaration with an empty string literal |
| 7 |
and provides a fix-it to replace the declaration with a single-argument ``static_assert`` declaration. |
| 8 |
|
| 9 |
The check is only applicable for C++17 and later code. |
| 10 |
|
| 11 |
The following code: |
| 12 |
|
| 13 |
.. code-block:: c++ |
| 14 |
|
| 15 |
void f_textless(int a) { |
| 16 |
static_assert(sizeof(a) <= 10, ""); |
| 17 |
} |
| 18 |
|
| 19 |
is replaced by: |
| 20 |
|
| 21 |
.. code-block:: c++ |
| 22 |
|
| 23 |
void f_textless(int a) { |
| 24 |
static_assert(sizeof(a) <= 10); |
| 25 |
} |