I added a new check to check for "unsafe classes". Example code:

class C {
public:
    C(const std::string &s) : s(s) {}
    const std::string &s;
};

Cppcheck will now warn that "C::s" is unsafe. You can easily make a mistake when using this class that leads to dead reference usage.

I am not very happy about the warning message. Maybe I think it's ~50% good. How can we make it better? Any suggestions?

Short message:

"Unsafe class: The const reference member 'C::s' is initialized by a const reference constructor argument. You need to be careful about lifetime issues."

Verbose message:

"Unsafe class checking: The const reference member 'C::s' is initialized by a const reference constructor argument. You need to be careful about lifetime issues. If you pass a local variable or temporary value in this constructor argument, be extra careful. If the argument is always some global object that is never destroyed then this is safe usage. However it would be defensive to make the member 'C::s' a non-reference variable or a smart pointer.",