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.
9 auto f() -> std::optional<std::string>;
14 for (char c : f().value()) { (void) c; } // { dg-warning "dangling reference" "" { target c++20_down } }