cpp:S5408 '"constexpr" functions should not be declared "inline"' is wrong about variables

  • versions used : SonarQube 8.7.1

I found this rule after I wrote some violating code using inline constexpr variables.

The rule is explained as follows:

Which is actually wrong in the general case about variables. See constexpr specifier (since C++11) - cppreference.com
Only static member variables are implicitly inline.

Specially, global variables, defined at namespace scope are not implicitly inline.

1 Like

Hello @torgeir.skogen,

You are totally right, I created a ticket to correct this issue. Thank you for reporting it!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.