[Boost-bugs] [Boost C++ Libraries] #8668: BOOST_FOREACH breaks on clang 3.2 but not on gcc 4.7.2

Subject: [Boost-bugs] [Boost C++ Libraries] #8668: BOOST_FOREACH breaks on clang 3.2 but not on gcc 4.7.2
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-06-07 15:08:46


#8668: BOOST_FOREACH breaks on clang 3.2 but not on gcc 4.7.2
----------------------+------------------------------
 Reporter: juxeii@… | Type: Bugs
   Status: new | Milestone: To Be Determined
Component: None | Version: Boost 1.52.0
 Severity: Problem | Keywords:
----------------------+------------------------------
 Consider this snippet:

 {{{
 #include <vector>
 #include <boost/foreach.hpp>

 class A : public std::vector<int>
 {
 public:
     template <class T>
     operator const T &() const;
 };

 void foo(){
    A colA;
    int b = 1;
    BOOST_FOREACH(b, colA)
    {
         ;
    }
 }
 }}}

 clang 3.2 throws this error:

 {{{
 error: conditional expression is ambiguous; 'rvalue_probe<A>' can be
 converted to 'A' and vice versa BOOST_FOREACH(b, colA)

 expanded from macro 'BOOST_FOREACH' f (boost::foreach_detail_::auto_any_t
 BOOST_FOREACH_ID(_foreach_col) = BOOST_FOREACH_CONTAIN(COL))

 expanded from macro 'BOOST_FOREACH_CONTAIN' BOOST_FOREACH_EVALUATE(COL)

 expanded from macro 'BOOST_FOREACH_EVALUATE' (true ?
 boost::foreach_detail_::make_probe((COL),
 BOOST_FOREACH_ID(_foreach_is_rvalue)) : (COL))
 }}}

 gcc in version 4.7.2 compiles this snippet with no error.
 Is this a bug of gcc, clang or boost?

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8668>
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:13 UTC