Declaring a function or a static member variable constexpr
makes it implicitly inline.
In that situation, explicitly using the inline
keyword would be redundant, and might lead to confusion if it’s used in some cases but
not others. It’s better to simply omit it.
Noncompliant code example
inline constexpr int addOne(int n) { return n+1; } // Noncompliant
struct A {
inline constexpr static int secretNumber = 0; // Noncompliant
};
Compliant solution
constexpr int addOne(int n) { return n+1; }
struct A {
constexpr static int secretNumber = 0;
};