gcc/testsuite/g++.dg/concepts/diagnostic15.C
raw| 1 | // PR c++/95310 |
| 2 | // { dg-do compile { target concepts } } |
| 3 | |
| 4 | template <class T> |
| 5 | using iter_reference_t = decltype(*T{}); |
| 6 | |
| 7 | template <typename F> |
| 8 | struct result { using type = iter_reference_t<F>; }; |
| 9 | |
| 10 | template <class Out, const int& N> |
| 11 | concept indirectly_writable = requires(Out o) { // { dg-bogus "F =" } |
| 12 | iter_reference_t<Out>(*o) = N; |
| 13 | }; |
| 14 | |
| 15 | const int a = 0; |
| 16 | static_assert(indirectly_writable<const int*, a>); // { dg-error "assert" } |