blob: aee7a29019b9a6ba5c70f4ba878e192528e1a21a [file] [log] [blame]
// { dg-do compile { target c++17 } }
// { dg-options "-Wdangling-reference" }
// Check that we warn here even without -Wsystem-headers.
#include <optional>
#include <string>
auto f() -> std::optional<std::string>;
void
g ()
{
for (char c : f().value()) { (void) c; } // { dg-warning "dangling reference" }
}