[ET Trac] [Einstein Toolkit] #1521: Piraha smart_ptr can't handle self assignment
Einstein Toolkit
trac-noreply at einsteintoolkit.org
Thu Jan 16 09:19:18 CST 2014
#1521: Piraha smart_ptr can't handle self assignment
-----------------------+----------------------------------------------------
Reporter: eschnett | Owner: sbrandt
Type: defect | Status: review
Priority: major | Milestone:
Component: Cactus | Version: development version
Resolution: | Keywords:
-----------------------+----------------------------------------------------
Changes (by sbrandt):
* status: assigned => review
Comment:
The patch is simple, but actually getting a segfault to trigger was a bit
harder than I expected.
#include <iostream>
#include "smart_ptr.hpp"
struct A {
A() { std::cout << "Construct" << std::endl; }
~A() { std::cout << "Destruct" << std::endl; }
// need virtual, otherwise no dereference occurs
virtual void foo() {
std::cout << "Foo" << std::endl;
}
};
int main() {
cctki_piraha::smart_ptr<A> y(new A(),false);
y = y;
y->foo();
return 0;
}
--
Ticket URL: <https://trac.einsteintoolkit.org/ticket/1521#comment:4>
Einstein Toolkit <http://einsteintoolkit.org>
The Einstein Toolkit
More information about the Trac
mailing list