Opened 12 years ago
Closed 12 years ago
#4174 closed Patches (fixed)
Patch to fix auto_ptr usage errors in ptr_container tests
Reported by: | Douglas Gregor | Owned by: | Thorsten Ottosen |
---|---|---|---|
Milestone: | Boost 1.43.0 | Component: | ptr_container |
Version: | Boost Development Trunk | Severity: | Problem |
Keywords: | Cc: |
Description
At several places in the ptr_container tests, we have the following pattern:
void f(const std::auto_ptr<int> &); void g() {
f(std::auto_ptr<int>(new int(5)));
}
This is code is ill-formed in C++98/03, because the compiler is required to check there there exits a copy constructor that would be able to make a copy of the auto_ptr before binding it to a reference, even if that copy won't actually be made. Not all compilers diagnose this error, but Clang and EDG in strict mode do diagnose the problem.
The attached patch fixes the issue.
Attachments (1)
Change History (3)
by , 12 years ago
Attachment: | ptr_container_const_ref_fixes.patch added |
---|
comment:1 by , 12 years ago
Component: | None → ptr_container |
---|---|
Owner: | set to |
comment:2 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
(In [61718]) At several places in the ptr_container tests, we have the following pattern:
void f(const std::auto_ptr<int> &); void g() {
f(std::auto_ptr<int>(new int(5)));
}
This is code is ill-formed in C++98/03, because the compiler is required to check there there exits a copy constructor that would be able to make a copy of the auto_ptr before binding it to a reference, even if that copy won't actually be made. Not all compilers diagnose this error, but Clang and EDG in strict mode do diagnose the problem.
Fixes #4174.
Patch fixing the problem