| 1 |
// PR c++/110031 |
| 2 |
// { dg-do compile { target c++17 } } |
| 3 |
|
| 4 |
template <typename T> |
| 5 |
[[deprecated]] |
| 6 |
inline constexpr bool t = true ; |
| 7 |
|
| 8 |
template <bool a> |
| 9 |
struct enableif; |
| 10 |
|
| 11 |
template<> |
| 12 |
struct enableif<true> |
| 13 |
{ |
| 14 |
using y = int; |
| 15 |
}; |
| 16 |
template <bool a> |
| 17 |
using enableif_t = typename enableif<a>::y; |
| 18 |
|
| 19 |
template <typename T, enableif_t<t<T>> = 0> // { dg-warning "deprecated" } |
| 20 |
struct A { A(T &&) { }}; |
| 21 |
|
| 22 |
template <typename T> |
| 23 |
struct A<T> { |
| 24 |
A(T &&) = delete; |
| 25 |
A() = delete; |
| 26 |
}; |
| 27 |
|
| 28 |
int main(void) |
| 29 |
{ |
| 30 |
A<double> a(5.3); // { dg-error "use of deleted function" } |
| 31 |
return 0; |
| 32 |
} |