Daniela Engert wrote:
I've reworked my pull-request by incorporating your suggestions with some minor additional tweaks required to make it work. The tests of Boost.Typeof pass with msvc10, msvc12, msvc14, and msvc14.1, and a test run of the full Boost testsuite with msvc14.1 is successful as well. Given the generality of the suggested change, I'd appreciate if someone would test it on gcc and clang, too.
Tests pass for me on Cygwin g++ 6.3.0 (03/11/14/1z), clang++ 3.9.1 (03/11/14/1z), msvc-8.0, 10.0, 11.0, 12.0, 14.1.
+#define BOOST_TYPEOF(expr) boost::type_of::remove_cv_ref_t<decltype((boost::type_of::ensure_obj(expr)))>
The ensure_obj helper shouldn't be necessary here. The above tests also pass with +#define BOOST_TYPEOF(expr) boost::type_of::remove_cv_ref_t<decltype(expr)> and the definition of ensure_obj removed. I've also enabled Travis for typeof, so any future pushes in the PR should be CI-tested. Tests fail with msvc-14.1 /std:c++latest because of use of binder1st, auto_ptr, unary_function and so on, but that's a separate issue and unrelated to these changes, although we'll probably have to fix it at some point.