Modify rule S6013: reword

This commit is contained in:
Amelie Renard 2023-10-02 16:54:52 +02:00 committed by Amélie Renard
parent 258f2055da
commit 9474d7d41d

View File

@ -1,8 +1,8 @@
== Why is this an issue?
{cpp}11 version of the standard introduced ``++static_assert(expr, message)++`` to check that the compile-time constant expression ``++expr++`` is true.
{cpp}11 introduced ``++static_assert(expr, message)++`` to check that the compile-time constant expression ``++expr++`` is true.
{cpp}17 version of the standard has made the second argument ``++message++`` optional. This rule flags occurrences of ``++std::static_assert++`` where the second argument message is empty or a substring of ``++expr++``.
{cpp}17 has made the second argument ``++message++`` optional. This rule flags occurrences of ``++std::static_assert++`` where the second argument message is empty or a substring of ``++expr++``.
=== Noncompliant code example
@ -11,9 +11,8 @@
----
template <class T>
T f(T i) {
static_assert(std::is_integral<T>::value, ""); // Noncompliant, remove the empty string second argument.
// or
static_assert(std::is_integral<T>::value, "std::is_integral"); // Noncompliant, remove the redundant second argument.
static_assert(std::is_integral<T>::value, ""); // Noncompliant: remove the empty string second argument.
static_assert(std::is_integral<T>::value, "std::is_integral"); // Noncompliant: remove the redundant second argument.
// ...
}
----