gcc/testsuite/g++.dg/cpp2a/concepts-narrowing1.C
raw| 1 | // PR c++/104594 |
| 2 | // { dg-do compile { target c++20 } } |
| 3 | |
| 4 | template <unsigned char DIM_FROM> |
| 5 | concept Geometry = (DIM_FROM == -1); |
| 6 | |
| 7 | template <class INIT> |
| 8 | requires Geometry<INIT::n> |
| 9 | auto GaussNewton(const INIT& init) -> void {} |
| 10 | |
| 11 | template<int N> |
| 12 | struct X { |
| 13 | static constexpr int n = N; |
| 14 | }; |
| 15 | |
| 16 | int main() { GaussNewton(X<-1>{}); } // { dg-error "no match|narrowing" } |