gcc/testsuite/g++.dg/torture/pr33572.C
raw| 1 | // { dg-do run } |
| 2 | // { dg-options "-std=c++98" } |
| 3 | // { dg-skip-if "requires hosted libstdc++ for vector" { ! hostedlib } } |
| 4 | |
| 5 | #include <vector> |
| 6 | #include <memory> |
| 7 | |
| 8 | struct Foo { virtual void f() {} }; |
| 9 | |
| 10 | int main(int argc, char**) |
| 11 | { |
| 12 | std::auto_ptr<Foo> foo; |
| 13 | if (argc >= 0) { |
| 14 | foo.reset(new Foo()); |
| 15 | } else { |
| 16 | std::vector<int> v; |
| 17 | } |
| 18 | Foo* p = foo.release(); |
| 19 | p->f(); |
| 20 | } |