gcc/testsuite/g++.dg/ext/attr-trailing1.C
raw| 1 | // PR c++/90333 |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | |
| 4 | auto l = [] [[nodiscard]] () -> int { return 0; }; |
| 5 | auto l2 = []() -> int __attribute ((warn_unused_result)) { return 0; }; |
| 6 | auto f() -> int __attribute ((warn_unused_result)); |
| 7 | auto f() -> int { return 0; } |
| 8 | |
| 9 | int main() |
| 10 | { |
| 11 | l(); // { dg-warning "nodiscard" } |
| 12 | l2(); // { dg-warning "unused_result" } |
| 13 | f(); // { dg-warning "unused_result" } |
| 14 | } |