gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-escape-2.C
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-O2 -Wstrict-aliasing" } */ |
| 3 | /* { dg-skip-if "requires hosted libstdc++ for list" { ! hostedlib } } */ |
| 4 | |
| 5 | #include<list> |
| 6 | |
| 7 | struct A |
| 8 | { |
| 9 | virtual ~A(); |
| 10 | }; |
| 11 | |
| 12 | A* foo(); |
| 13 | |
| 14 | void bar(std::list<int> x) |
| 15 | { |
| 16 | std::list<int> y = x; |
| 17 | if (*y.rbegin()) |
| 18 | delete foo(); |
| 19 | } |
| 20 |