| 1 |
// PR c++/60992 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
struct ScopeGuardGenerator { }; |
| 5 |
|
| 6 |
struct FF |
| 7 |
{ |
| 8 |
template < class F, class ... Ts > |
| 9 |
void |
| 10 |
operator () (F & ...) // { dg-warning "omission of ',' before varargs '...' is deprecated" "" { target c++26 } } |
| 11 |
{ |
| 12 |
const int n = sizeof ... (Ts) + 1; |
| 13 |
void *mutexes[n]; |
| 14 |
auto _on_scope_exit_var_0 = |
| 15 |
ScopeGuardGenerator () + [&mutexes] { }; |
| 16 |
} |
| 17 |
}; |
| 18 |
|
| 19 |
template < class F > |
| 20 |
int operator+ (ScopeGuardGenerator, F) { return 1; } |
| 21 |
|
| 22 |
struct D |
| 23 |
{ |
| 24 |
template < class T0, class T1, class T2, class ... T > |
| 25 |
void |
| 26 |
operator () (T0, T1, const T2 & t2, T & ... t) |
| 27 |
{ |
| 28 |
base (t2, t ...); |
| 29 |
} |
| 30 |
FF base; |
| 31 |
}; |
| 32 |
|
| 33 |
D run_with_locks; |
| 34 |
|
| 35 |
void Fn () |
| 36 |
{ |
| 37 |
run_with_locks ([] { }, 0, 0); |
| 38 |
} |