[SERVER-1486] DBClientPaired::auth shadows virtual function DBClientWithCommands::auth, causes warnings with -Wall -Werror -Woverloaded-virtual Created: 26/Jul/10  Updated: 12/Jul/16  Resolved: 29/Jul/10

Status: Closed
Project: Core Server
Component/s: Internal Client
Affects Version/s: 1.5.6
Fix Version/s: 1.5.7

Type: Improvement Priority: Major - P3
Reporter: Andrew Morrow (Inactive) Assignee: Alberto Lerner
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Unbuntu 10.04 x86_64, gcc 4.2


Participants:

 Description   

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.



 Comments   
Comment by Andrew Morrow (Inactive) [ 28/Jul/10 ]

Did the specific problem with dbclient.h get fixed here: http://github.com/mongodb/mongo/commit/1c138b4c77c30c20c9fc9d4e0565d3b4204b2ff4?

If so, maybe we can close this?

Generated at Thu Feb 08 02:57:09 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.