[SERVER-8894] Invalid noncopyable logic in MongoDB C++ client (src/mongo/util/goodies.h) Created: 07/Mar/13 Updated: 23/Nov/16 Resolved: 23/Nov/16 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Code |
| Affects Version/s: | 2.4.0-rc2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Hillel Lubman | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Linux / g++ |
||
| Operating System: | Linux |
| Steps To Reproduce: | Compile with g++ against C++ client library with -Wextra flag. |
| Participants: |
| Description |
|
I get this warning when compiling against MongoDB C++ client library: ...mongo/util/goodies.h:136: warning: base class ‘class boost::noncopyable_::noncopyable’ should be explicitly initialized in the copy constructor src/mongo/util/goodies.h has the following code: class ThreadSafeString : boost::noncopyable { ThreadSafeString( const ThreadSafeString& other ) What is the point first deriving from private boost::noncopyable and then defining a copy constructor with a body? It defeats the purpose. Either it could just define a private copy constructor, or define none at all and privately derive from boost::noncopyable. |
| Comments |
| Comment by Eric Milkie [ 23/Nov/16 ] |
|
ThreadSafeString no longer inherits from boost::noncopyable; the class is made noncopyable via a different method. |
| Comment by Hillel Lubman [ 13/Mar/13 ] |
|
The logic is also quite misleading, since defining a copy constructor renders deriving from boost::noncopyable useless. I.e. you can copy ThreadSafeString and nothing will prevent it. So what was the intention? To make it noncopyable or not? |