From 3c2a976d2a0e62aefece9ba137ed766c2d7b3a1b Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Sun, 30 Apr 2006 03:01:58 +0000 Subject: [PATCH] Workarounds for a nasty vc-7.1 bug that only shows up in the iterator library tests. [SVN r33866] --- include/boost/concept_check/Attic/msvc.hpp | 92 ++++++++++++++-------- include/boost/concept_check/msvc.hpp | 92 ++++++++++++++-------- 2 files changed, 120 insertions(+), 64 deletions(-) diff --git a/include/boost/concept_check/Attic/msvc.hpp b/include/boost/concept_check/Attic/msvc.hpp index 102cc07..3968469 100755 --- a/include/boost/concept_check/Attic/msvc.hpp +++ b/include/boost/concept_check/Attic/msvc.hpp @@ -11,52 +11,80 @@ namespace boost -{ - template - struct concept_check +{ + namespace concept_checking { - virtual void failed(Model* x) - { - x->~Model(); - } - - int test; - }; - + template + struct concept_check_ + { + virtual void failed(Model* x) + { + x->~Model(); + } + }; + } + # ifdef BOOST_OLD_CONCEPT_SUPPORT - template - struct constraint_check + namespace concept_checking { - virtual void failed(Model* x) - { - x->constraints(); - } + template + struct constraint_check + { + virtual void failed(Model* x) + { + x->constraints(); + } + }; + } + + template + struct concept_check + : mpl::if_c< + concept_checking::has_constraints::value + , concept_checking::constraint_check + , concept_checking::concept_check_ + >::type + {}; - int test; - }; +# else template - typename mpl::if_c< - concept_checking::has_constraints::value - , constraint_check - , concept_check - >::type concept_check_(void(*)(Model)); + struct concept_check + : concept_checking::concept_check_ + {}; + +# endif + +# if BOOST_WORKAROUND(BOOST_MSVC, == 1310) + + // + // The iterator library sees some really strange errors unless we + // use partial specialization to extract the model type with + // msvc-7.1 + // + template + struct concept_check + : concept_check + { }; + +# define BOOST_CONCEPT_ASSERT( ModelInParens ) \ + enum { BOOST_PP_CAT(boost_concept_check,__LINE__) = \ + sizeof(::boost::concept_check) \ + } # else template - concept_check concept_check_(void(*)(Model)); + concept_check + concept_check_(void(*)(Model)); -# endif - - // Usage, in class or function context: - // - // BOOST_CONCEPT_ASSERT((UnaryFunctionConcept)); -# define BOOST_CONCEPT_ASSERT( ModelInParens ) \ +# define BOOST_CONCEPT_ASSERT( ModelInParens ) \ enum { BOOST_PP_CAT(boost_concept_check,__LINE__) = \ - sizeof(boost::concept_check_((void(*) ModelInParens)0).test) \ + sizeof(::boost::concept_check_((void(*) ModelInParens)0)) \ } + +# endif } #endif // BOOST_CONCEPT_CHECK_MSVC_DWA2006429_HPP diff --git a/include/boost/concept_check/msvc.hpp b/include/boost/concept_check/msvc.hpp index 102cc07..3968469 100755 --- a/include/boost/concept_check/msvc.hpp +++ b/include/boost/concept_check/msvc.hpp @@ -11,52 +11,80 @@ namespace boost -{ - template - struct concept_check +{ + namespace concept_checking { - virtual void failed(Model* x) - { - x->~Model(); - } - - int test; - }; - + template + struct concept_check_ + { + virtual void failed(Model* x) + { + x->~Model(); + } + }; + } + # ifdef BOOST_OLD_CONCEPT_SUPPORT - template - struct constraint_check + namespace concept_checking { - virtual void failed(Model* x) - { - x->constraints(); - } + template + struct constraint_check + { + virtual void failed(Model* x) + { + x->constraints(); + } + }; + } + + template + struct concept_check + : mpl::if_c< + concept_checking::has_constraints::value + , concept_checking::constraint_check + , concept_checking::concept_check_ + >::type + {}; - int test; - }; +# else template - typename mpl::if_c< - concept_checking::has_constraints::value - , constraint_check - , concept_check - >::type concept_check_(void(*)(Model)); + struct concept_check + : concept_checking::concept_check_ + {}; + +# endif + +# if BOOST_WORKAROUND(BOOST_MSVC, == 1310) + + // + // The iterator library sees some really strange errors unless we + // use partial specialization to extract the model type with + // msvc-7.1 + // + template + struct concept_check + : concept_check + { }; + +# define BOOST_CONCEPT_ASSERT( ModelInParens ) \ + enum { BOOST_PP_CAT(boost_concept_check,__LINE__) = \ + sizeof(::boost::concept_check) \ + } # else template - concept_check concept_check_(void(*)(Model)); + concept_check + concept_check_(void(*)(Model)); -# endif - - // Usage, in class or function context: - // - // BOOST_CONCEPT_ASSERT((UnaryFunctionConcept)); -# define BOOST_CONCEPT_ASSERT( ModelInParens ) \ +# define BOOST_CONCEPT_ASSERT( ModelInParens ) \ enum { BOOST_PP_CAT(boost_concept_check,__LINE__) = \ - sizeof(boost::concept_check_((void(*) ModelInParens)0).test) \ + sizeof(::boost::concept_check_((void(*) ModelInParens)0)) \ } + +# endif } #endif // BOOST_CONCEPT_CHECK_MSVC_DWA2006429_HPP