Daily bump.
[gcc.git] / gcc / testsuite / g++.dg / warn / Wdangling-reference4.C
blobada70dd683a327c5ebbc0547a1d1b3f5205076c0
1 // { dg-do compile { target c++17 } }
2 // { dg-additional-options "-Wdangling-reference" }
3 // { dg-skip-if "requires hosted libstdc++ for string" { ! hostedlib } }
4 // Check that we warn here even without -Wsystem-headers.
6 #include <optional>
7 #include <string>
9 auto f() -> std::optional<std::string>;
11 void
12 g ()
14   for (char c : f().value()) { (void) c; } // { dg-warning "dangling reference" "" { target c++20_down } }