
2011/7/22 Frédéric Bron <frederic.bron@m4x.org>
What does your code look like that detects void types? I use the following EXPR_IS_VOID macro myself (which is not originally mine, but I think I have modified it from the original after some testing); feel free to pilfer. The double comma operator thingy is intended to work even if the type of ( Expr ) has an overloaded comma operator, but I've found that GCC has issues with this construct, hence the two versions.
Thank you for help. I have tested your code for void detection which GNUC version gives identical results to the one I use (on msvc, g++ and intel):
namespace detail {\ struct returns_void_t {}; static ::boost::type_traits::yes_type returns_void(returns_void_t);\ static ::boost::type_traits::no_type returns_void(int);\ } template <typename T> int operator,(const T&, ::detail::returns_void_t); template <typename T> int operator,(const volatile T&, ::detail::returns_void_t);
#define RETURNS_VOID_IMPL(Expr)\ sizeof(::boost::type_traits::yes_type)\ ==\ sizeof(::detail::returns_void(((Expr), ::detail::returns_void_t())))
[...] I wonder, does the double comma trick I had for MSVC also work for GCC > 4.4.1 and/or Intel? And, if so, does it change the results? - Jeff