| 1 | // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3559.pdf |
| 2 | |
| 3 | int main() { |
| 4 | int (*fp)(int, char) = [](auto a, auto b){ return a + b; }; |
| 5 | |
| 6 | #if 0 |
| 7 | struct /* anonymous */ |
| 8 | { |
| 9 | template<class A, class B> |
| 10 | auto operator()(A a, B b) const // N3386 Return Type Deduction |
| 11 | { return a + b; } |
| 12 | private: |
| 13 | // Note: We don't want to simply forward the call to operator() |
| 14 | // since forwarding is not entirely transparent, and could |
| 15 | // introduce visible side-effects. To produce the |
| 16 | // desired semantics we copy the parameter-clause |
| 17 | // and body exactly |
| 18 | template<class A, class B> |
| 19 | static auto __invoke(A a, B b) { // N3386 Return Type Deduction return a + b; |
| 20 | } |
| 21 | template<class A, class B, class R> |
| 22 | using fptr_t = R (*) (A, B); |
| 23 | public: |
| 24 | template<class A, class B, class R> |
| 25 | operator fptr_t<R, A, B>() const { |
| 26 | return &__invoke; |
| 27 | } } L; |
| 28 | |
| 29 | int (*fp)(int, char) = L; |
| 30 | #endif |
| 31 | } |
| 32 |
nothing calls this directly
no outgoing calls
no test coverage detected