gcc/testsuite/g++.dg/warn/Wstringop-overflow-8.C
raw| 1 | // PR c++/103534 |
| 2 | // { dg-additional-options "-O -Wall" } |
| 3 | // { dg-skip-if "requires hosted libstdc++ for string" { ! hostedlib } } |
| 4 | |
| 5 | #include <string> |
| 6 | |
| 7 | std::string foo(std::string x) |
| 8 | { |
| 9 | // This used to get a bogus -Wstringop-overflow warning. |
| 10 | return std::string("1234567890123456") + x; |
| 11 | } |