blob: 0f8ecf48cbd03f4c4ce9e90b283300d89a77c1d3 [file] [log] [blame]
// { dg-do compile { target c++23 } }
// PR libstdc++/119197 - std::expected should be nodiscard
#include <expected>
std::expected<int, int> f();
std::expected<void, int> g();
void
test_nodiscard()
{
f(); // { dg-warning "ignoring return" }
std::expected<int, int>(42); // PR c++/85973: should warn "ignoring temporary"
(void)f(); // OK
g(); // { dg-warning "ignoring return" }
std::expected<void, int>(); // PR c++/85973: should warn "ignoring temporary"
(void)g(); // OK
}