By analyzing code using SonarLint, I got a message (the title of the question) about a destructor that is declared like below:
class Foo
{
public:
. // default ctor
. // parameterized ctor
.
inline ~Foo() = default; // dtor
.
. // copy ctor = delete
. // copy assignment operator = delete
. // move ctor
. // move assignment operator
private:
...
mutable std::vector< std::vector<char> > m_Matrix;
...
};
Here is the message's description: Declaring a function or a static member variable constexpr makes it implicitly inline.
I don't think the dtor of this class can be constexpr
or consteval
because it has a non-static data member of type std::vector
so ~Foo
has to call delete[]
at some point to deallocate the vector's storage.
So why is SonarLint showing this message? Is it because of = default
? Does any defaulted special member function become implicitly constexpr
?