| 1 |
// PR c++/124389 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
template <typename T> struct Empty {}; |
| 5 |
|
| 6 |
template <typename T> |
| 7 |
constexpr bool test(T) noexcept { return true; } |
| 8 |
|
| 9 |
template <typename T> |
| 10 |
struct always_true { |
| 11 |
static constexpr bool value = true; |
| 12 |
static_assert(test(Empty<T>{}), "BUG"); |
| 13 |
}; |
| 14 |
|
| 15 |
template <typename T> |
| 16 |
struct AAA { |
| 17 |
template <typename U, bool = always_true<U>::value> |
| 18 |
AAA(U) {} |
| 19 |
}; |
| 20 |
|
| 21 |
template <int (*U) (AAA<int>)> |
| 22 |
void test_function() { |
| 23 |
auto r = U(AAA<int>(1)); |
| 24 |
} |
| 25 |
|
| 26 |
int main() { |
| 27 |
return 0; |
| 28 |
} |