| 1 |
// PR c++/69889 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
// { dg-additional-options "-Wno-return-type" } |
| 4 |
|
| 5 |
template <typename F> struct Tag { |
| 6 |
static void fp() { f()(0); } |
| 7 |
static F f() {} |
| 8 |
}; |
| 9 |
|
| 10 |
struct Dispatch { |
| 11 |
template <typename F> Dispatch(F&&) : f(Tag<F>::fp) {} |
| 12 |
void (*f)(); |
| 13 |
}; |
| 14 |
|
| 15 |
struct Empty { Empty(Empty&&); }; |
| 16 |
|
| 17 |
struct Value { |
| 18 |
Value(); |
| 19 |
template <typename U> Value(U); |
| 20 |
void call(Dispatch); |
| 21 |
Empty e; |
| 22 |
}; |
| 23 |
|
| 24 |
struct EmptyValue { |
| 25 |
EmptyValue(EmptyValue&&); |
| 26 |
EmptyValue(); |
| 27 |
}; |
| 28 |
|
| 29 |
struct User { |
| 30 |
User() { |
| 31 |
Value().call([](Value) { return EmptyValue(); }); |
| 32 |
} |
| 33 |
}; |
| 34 |
|
| 35 |
User user; |