[Bug c++/23896] [4.0/4.1 Regression] boost::tie() = std::pair doesn't compile

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Sep 15 16:22:00 GMT 2005


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-15 16:22 -------
Reduced as far as I could do:
namespace boost{
  template <bool x> struct STATIC_ASSERTION_FAILURE {};
  struct null_type;
  template <class T0 = null_type, class T1 = null_type, class T2 = null_type> class tuple;
  template <class TT> struct cons {
    typedef TT tail_type;
  };
  template<class T> struct length {
    static const int value = 1 + length<typename T::tail_type>::value;
  };
  template<> struct length<null_type> {
    static const int value = 0;
  };
  namespace detail {
    template <class T0, class T1, class T2> struct map_tuple_to_cons {
      typedef cons<typename map_tuple_to_cons<T1, T2, null_type>::type > type;
    };
    template <> struct map_tuple_to_cons<null_type, null_type, null_type> {
      typedef null_type type;
    };
  }
  template <class T0, class T1, class T2>  struct tuple : detail::map_tuple_to_cons<T0, T1, T2>::type     
{
    tuple& operator=(int t1) {
      int t = sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( length<tuple>::value == 2 ) >);
    }
  };
}
int main() {
  boost::tuple<int&, int&> a;
  a = 1;
}


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-09-15 16:22:23
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23896



More information about the Gcc-bugs mailing list