test.cxx:10:3: warning: Member variable 'Bar::hash' is not initialized in the constructor. [uninitMemberVar]
Bar(int the_hash) : hash(the_hash) {}
^
If you rename the member to e.g. _hash the warning disappears. The same happens for other template specializatons, e.g. std::size and a member variable named size.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Having a member variable named
hash
seems to clash with template specializations ofstd::hash
. The following snippetresults in
If you rename the member to e.g.
_hash
the warning disappears. The same happens for other template specializatons, e.g.std::size
and a member variable namedsize
.Here is another reproducer that may or may not be the same problem:
results in cppcheck complaining about a non-existent
store
member:Thanks for reporting, see https://trac.cppcheck.net/ticket/13443 and https://trac.cppcheck.net/ticket/13444