gcc/testsuite/g++.dg/cpp2a/concepts-requires8.C
raw| 1 | // { dg-do compile { target c++20 } } |
| 2 | |
| 3 | template <class T, class U> |
| 4 | concept C = requires (T t, U u) { t + u; }; // { dg-message "in requirements" } |
| 5 | |
| 6 | template <class T, class U> |
| 7 | requires C<T,U> |
| 8 | void f(T t, U u) { t + u; } |
| 9 | |
| 10 | struct non_addable { }; |
| 11 | |
| 12 | int main() |
| 13 | { |
| 14 | // FIXME: This diagnostic is being emitted twice, when it should |
| 15 | // be emitted just once. |
| 16 | using U = decltype(f(42, non_addable{})); // { dg-error "" } |
| 17 | } |