Get C++03 __invoke working for bullet 5 of INVOKE.

This patch does a couple of things to get __invoke working for free-functions
and call objects.

1. Turn all uses of declval<Tp>() into declval<Tp&>(). The C++03 __invoke only
   supports lvalues but it will be used when the compiler supports rvalue
   references but not variadic templates. This change makes sure we don't
   generate an rvalue.

2. Call objects for bullet 5 are now passed by reference and not value. Copying
   the functor is incorrect. It will fail to compile for non-copyable functors
   and it will discard cv-qualifiers on the call object, possibly leading to the
   wrong function being called. I suspect that the reason the call object
   was originally taken by value was to support temporary call objects.
   However __invoke is only used internally and it is never given a temporary.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@243368 91177308-0d34-0410-b5e6-96231b3b80d8
1 file changed