-
Type: Improvement
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 1.5.6
-
Component/s: Internal Client
-
None
-
Environment:Unbuntu 10.04 x86_64, gcc 4.2
When compiling against the C++ driver headers in a project which uses -Woverloaded-virtual, gcc complains as follows:
cc1plus: warnings being treated as errors
In file included from /tmp/mongo-tmp-install/include/mongo/client/connpool.h:21,
from db/AccessControl.cc:3:
/tmp/mongo-tmp-install/include/mongo/client/dbclient.h: At global scope:
/tmp/mongo-tmp-install/include/mongo/client/dbclient.h:390: error: 'virtual bool mongo::DBClientWithCommands::auth(const std::string&, const std::string&, const std::string&, std::string&, bool)' was hidden
/tmp/mongo-tmp-install/include/mongo/client/dbclient.h:899: error: by 'bool mongo::DBClientPaired::auth(const std::string&, const std::string&, const std::string&, std::string&)'
Shadowing virtual functions like this is typically pretty bad practice, since it makes it very non-obvious at the call-site what is going on. Also, -Woverloaded-virtual is a fairly common warning flag to enable.