Aleksey Gurtovoy <agurtovoy@meta-comm.com> writes:
I think msvc_is_incomplete<T>::value would always be true.
Yeah. Unfortunately, that's the only way I know to implement 'has_xxx' on MSVC so that it doesn't bark on incomplete types, and there is some code around which relies on it. On the other hand, Boost.Python probably doesn't depend on it, and since '/vmg' is not the default option, what we _can_ do is to guard the 'is_incomplete' check with something like BOOST_MPL_AUX_HAS_XXX_MSVC_NO_IS_INCOMPLETE and ask to define the symbol when compiling with '/vmg' or '#pragma pointers_to_members(full_generality, ...)'.
If that sounds like a reasonable compromise - in particular, to Nikolay - please feel free to implement it.
I did you one better. Now it just works with no BOOST_MPL_AUX_HAS_XXX_MSVC_NO_IS_INCOMPLETE switches required from the user: --- has_xxx.hpp 8 Jul 2003 05:10:02 -0000 1.16 +++ has_xxx.hpp 2 Aug 2003 15:58:44 -0000 1.17 @@ -3,8 +3,8 @@ // See http://www.boost.org for updates, documentation, and revision history. //----------------------------------------------------------------------------- // -// Copyright (c) 2002 -// Aleksey Gurtovoy +// Copyright (c) 2002-2003 +// Aleksey Gurtovoy and David Abrahams // // Permission to use, copy, modify, distribute and sell this software // and its documentation for any purpose is hereby granted without fee, @@ -73,10 +73,14 @@ template< typename T > struct msvc_is_incomplete { - struct incomplete_; - BOOST_STATIC_CONSTANT(bool, value = - sizeof(void (T::*)()) == sizeof(void (incomplete_::*)()) - ); + // MSVC is capable of some kinds of SFINAE. If U is an incomplete + // type, it won't pick the second overload + static char tester(...); + template <class U> + static char(& tester(type_wrapper<U>) )[sizeof(U) + 1]; + + BOOST_STATIC_CONSTANT( + bool, value = sizeof(tester(type_wrapper<T>())) == 1); }; -- Dave Abrahams Boost Consulting www.boost-consulting.com