| 1 |
// P2564R3 |
| 2 |
// { dg-do compile { target c++20 } } |
| 3 |
// Cribbed from clang's cxx2b-consteval-propagate.cpp. |
| 4 |
|
| 5 |
consteval int id(int i) { return i; } |
| 6 |
|
| 7 |
template <typename T> |
| 8 |
constexpr int f(T t); |
| 9 |
|
| 10 |
auto a1 = &f<char>; |
| 11 |
auto b1 = &f<int>; |
| 12 |
|
| 13 |
template <typename T> |
| 14 |
constexpr int f(T t) { |
| 15 |
return id(0); |
| 16 |
} |
| 17 |
|
| 18 |
template <typename T> |
| 19 |
constexpr int f2(T); |
| 20 |
|
| 21 |
auto a2 = &f2<char>; // { dg-error "taking address" } |
| 22 |
auto b2 = &f2<int>; // { dg-error "taking address" } |
| 23 |
|
| 24 |
template <typename T> |
| 25 |
constexpr int f2(T t) { |
| 26 |
return id(t); |
| 27 |
} |