gcc/testsuite/g++.dg/cpp1z/nodiscard7.C
raw| 1 | // PR c++/89070 - bogus [[nodiscard]] warning in SFINAE. |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | |
| 4 | struct A |
| 5 | { |
| 6 | [[nodiscard]] static int match() { return 42; } |
| 7 | }; |
| 8 | |
| 9 | template<typename T> |
| 10 | auto g() -> decltype( T::match(), bool() ) |
| 11 | { |
| 12 | return T::match(); |
| 13 | } |
| 14 | |
| 15 | int main() |
| 16 | { |
| 17 | g<A>(); |
| 18 | } |