aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/consteval30.C
blob: 035265e019ce7408aee420e769a8ce7e9e698966 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
// Test SFINAE for a non-constant consteval call.
// { dg-do compile { target c++20 } }

consteval int deref(const int* x) { return *x; }

template<const int* P, int = deref(P)> // { dg-bogus "null pointer" }
constexpr int f(int) { return 0; }

template<const int* P>
constexpr int f(...) { return 1; }

static_assert(f<nullptr>(0) == 1);