Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/consteval30.C

raw
1 // Test SFINAE for a non-constant consteval call.
2 // { dg-do compile { target c++20 } }
3
4 consteval int deref(const int* x) { return *x; }
5
6 template<const int* P, int = deref(P)> // { dg-bogus "null pointer" }
7 constexpr int f(int) { return 0; }
8
9 template<const int* P>
10 constexpr int f(...) { return 1; }
11
12 static_assert(f<nullptr>(0) == 1);