gcc/testsuite/g++.dg/cpp1z/nodiscard4.C
raw| 1 | // PR c++/79502 |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | |
| 4 | template<typename> |
| 5 | struct [[nodiscard]] missiles {}; |
| 6 | |
| 7 | missiles<void> make() { return {}; } |
| 8 | missiles<void> (*fnptr)() = make; |
| 9 | |
| 10 | int main() |
| 11 | { |
| 12 | make(); // { dg-warning "ignoring returned value of type" } |
| 13 | fnptr(); // { dg-warning "ignoring returned value of type" } |
| 14 | } |