[Boost-bugs] [Boost C++ Libraries] #3948: Conflict between concept_check and shared_ptr

Subject: [Boost-bugs] [Boost C++ Libraries] #3948: Conflict between concept_check and shared_ptr
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-02-19 21:49:03


#3948: Conflict between concept_check and shared_ptr
--------------------------------+-------------------------------------------
 Reporter: m.champlon@… | Owner: jsiek
     Type: Bugs | Status: new
Milestone: Boost 1.43.0 | Component: concept_check
  Version: Boost 1.42.0 | Severity: Problem
 Keywords: |
--------------------------------+-------------------------------------------
 Hello,

 The following code compiled with MSVC 2005 or 2008 :
 {{{
 #include <boost/concept_check.hpp>

 namespace boost
 {
     template< typename T >
     class some_type
     {};

     template< typename T1, typename T2 >
     bool operator<( const some_type< T1 >&, const some_type< T2 >& );
 }

 class c {};

 BOOST_CONCEPT_ASSERT((boost::LessThanComparable< c >));
 }}}

 Produces the following error :
 {{{
 1>C:\Users\Mat\Desktop\dev\include\boost/concept_check.hpp(242) : error
 C2784: 'bool boost::operator <(const boost::some_type<T> &,const
 boost::some_type<T2> &)' : could not deduce template argument for 'const
 boost::some_type<T> &' from 'c'
 1> ..\..\src\tests\turtle_test\concept_check_test.cpp(19) : see
 declaration of 'boost::operator <'
 1> C:\Users\Mat\Desktop\dev\include\boost/concept_check.hpp(241) :
 while compiling class template member function
 'boost::LessThanComparable<TT>::~LessThanComparable(void)'
 ...
 }}}

 Changing the namespace from boost to anything else (for instance nm)
 produces the correct error output e.g. :
 {{{
 1>C:\Users\Mat\Desktop\dev\include\boost/concept_check.hpp(242) : error
 C2676: binary '<' : 'c' does not define this operator or a conversion to a
 type acceptable to the predefined operator
 1> C:\Users\Mat\Desktop\dev\include\boost/concept_check.hpp(241) :
 while compiling class template member function
 'boost::LessThanComparable<TT>::~LessThanComparable(void)'
 ...
 }}}

 This use case is actually quite common because for instance in
 boost::shared_ptr there is such a construct, in the boost namespace of
 course. Therefore the following code exhibits the same problem :

 {{{
 #include <boost/concept_check.hpp>
 #include <boost/shared_ptr.hpp>

 class c {};

 BOOST_CONCEPT_ASSERT((boost::LessThanComparable< c >));
 }}}

 Maybe enclosing the concept check code into another level of namespace
 would prove enough to protect from the lookup ?

 Thank you !

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3948>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:02 UTC