Opened 10 years ago
Closed 10 years ago
#7746 closed Bugs (invalid)
Copy without assign problem in find_iterator.hpp
Reported by: | Owned by: | Marshall Clow | |
---|---|---|---|
Milestone: | To Be Determined | Component: | algorithm |
Version: | Boost 1.52.0 | Severity: | Problem |
Keywords: | Cc: | yogen.saini@… |
Description
I have encountered some errors in Boost, while running some static analyzer tool.
It is reported in boost/algorithm/string/find_iterator.hpp
The error is: find_iterator and split_iterator classes has user-written copy constructor but no corresponding user-written assignment operator.
I have attached a patch herewith. Is it valid to apply this fix?
Attachments (1)
Change History (6)
by , 10 years ago
Attachment: | find_iterator.hpp_patch added |
---|
comment:1 by , 10 years ago
Do you have a sample program that fails to compile/misbehaves because there is no explicit assignment operator?
comment:2 by , 10 years ago
comment:3 by , 10 years ago
Thanks for adding tests. I tried running my static analyzer tool (Coverity Prevent) on this test file and the tool is reporting the same errors. The patch I attached is no doubt, not a solution of this problem. So I want your feedback, whether this error should be fixed or assignment operator is left intentionally? If it is a bug, do we need to define a user-written assignment operator for it?
comment:4 by , 10 years ago
It doesn't appear to me that this is a bug. The compiler-generated assignment operator does the right thing.
The only reason (that I can tell) for the user-defined copy constructor is to call a particular base-class constructor.
I've never used Coverity on C++ code, but when I used it on C code (3 years ago), it had a very high false positive rate.
comment:5 by , 10 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Proposed patch