1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
// PR c++/99362 // { dg-do compile { target c++20 } } struct S { [[nodiscard]] S() {} S(int) {} }; int main() { S s; S(); // { dg-warning "ignoring return value" } (void)(S()); S t = 1; S(1); (void)(S(1)); }