Debian Codegraph @

gcc/testsuite/g++.dg/warn/Wstringop-overread-1.C

raw
1 // PR middle-end/98994
2 // { dg-do compile }
3 // { dg-additional-options "-Wstringop-overread -O2" }
4 // { dg-skip-if "requires hosted libstdc++ for string" { ! hostedlib } }
5
6 #include <string>
7
8 const char constantString[] = {42, 53};
9
10 void f(std::string& s)
11 {
12 s.insert(0, static_cast<const char*>(constantString), 2);
13 }