of course it would be good to get warnings about it.
I think there is an old ticket about passing nullptr to std::string constructor. But as far as I remember that does not mention = and +=.
but not sure how to proceed. The Library::container has a variable stdStringLike maybe if that is true it's ok to always warn for such operations with nullptr, I do not know.
Are there similar problems for other string classes QString, CString, wxString, ..?
Configuration of constructors is not possible right now as we don't support overloading yet :-(
I think it would be difficult to fix overloading. But not impossible.
As far as I know overloaded operators operator= and operator+= can not be configured but that would be nice.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
std::(w)string does not handle assignment of (or construction from) nullptr char strings.
I think it would be nice to get a warning in such cases,
MSVC reports this as C6387 (at least when constructing from a pointer that could be null):
https://docs.microsoft.com/en-us/cpp/code-quality/c6387?view=msvc-160
Thoughts?
Last edit: CHR 2021-01-22
of course it would be good to get warnings about it.
I think there is an old ticket about passing nullptr to std::string constructor. But as far as I remember that does not mention
=
and+=
.but not sure how to proceed. The
Library::container
has a variablestdStringLike
maybe if that is true it's ok to always warn for such operations with nullptr, I do not know.Are there similar problems for other string classes QString, CString, wxString, ..?
Configuration of constructors is not possible right now as we don't support overloading yet :-(
I think it would be difficult to fix overloading. But not impossible.
As far as I know overloaded operators
operator=
andoperator+=
can not be configured but that would be nice.