I realize this question may not belong here, but since the code in question uses Boost, I will ask here first and hope I may be forgiven for doing so. The following code does not fail with a compile time message from BOOST_MPL_ASSERT but it seems as if it should, with both VC9 and VC10: ---------------------------------------------------------------------- #include "stdafx.h" #include <boost/config.hpp> #include <boost/mpl/assert.hpp> struct test_default { }; namespace test_template1 { template < class T1, class P1_1, class P1_2 > char test(typename T1::template AMemberTemplate<P1_1,P1_2> *); template < class T1, class P1_1, class P1_2 > char (&test(...))[2]; } template < class T, class P1 = test_default, class P2 = test_default
struct test_template { typedef test_template type; BOOST_STATIC_CONSTANT(bool, value=sizeof(test_template1::test<T,P1,P2>(0))==1); }; namespace test_template2 { template < class T1, class P1_1 > char test(typename T1::template AMemberTemplate<P1_1> *); template < class T1, class P1_1 > char (&test(...))[2]; } template < class T, class P1
struct test_template < T, P1, test_default
{ typedef test_template type; BOOST_STATIC_CONSTANT(bool, value=sizeof(test_template2::test<T,P1>(0))==1); }; struct TType { template <class X> struct AMemberTemplate { }; }; void AFunction() { BOOST_MPL_ASSERT(( test_template<TType> )); } ------------------------------------------------------------------ It appears that the specialization of the 'test_template' template is being chosen instead of the main template itself but I do not see why this should be so. Is this my error or an actual bug in VC9 and VC10. If it is a VC bug, does Boost currently have a way to workaround it ?