awong-dev/ndk — pull request #131 by awong-dev (2014-06-08 04:45:45+00:00)
Title: Ensure substitution failure occurs in is_convertible before constructor access check

Using template check(T) in a situation such as
check(const MoveOnly&) generates a compile faliure on g++.
Talked with sleevi@ about this and it's unclear to both of us what
the spec says should happen here. In C++03, it seems valid for g++
to consider the type matching "valid" during overload resolution and
then to later to emit a diagnostic relating to access visibility of
the needed copy constructor for the MoveOnly type.

This patch just rewrites the SFINAE formulation to perform an effective
"enable_if" on the test overload that relies on the evaluation of the
conversiton. The implementation uses decltype() so it doesn't work with
C++03 however it make gcc pass.

The unittest file is also updated to add a check for this conversion.

Change-Id: I450b808764db35c33bdd1b5e85fad04c50be997a