Boost logo

Boost :

Subject: [boost] compressed_pair breaks with multiple instances of empty types
From: Hite, Christopher (christopher.hite_at_[hidden])
Date: 2014-05-14 11:26:16

I've been abusing compressed_pair to build a compressed_tuple. I'm pretty sure this bug can be fixed using intermediate types on the hierarchy.

struct Empty1{};
struct Empty2{};
int i=sizeof( boost::compressed_pair<Empty1, boost::compressed_pair<Empty1, Empty2> >); //boom int j=sizeof( boost::compressed_pair<Empty1, Empty2>); //ok int k=sizeof( boost::compressed_pair<Empty1, Empty1>); //ok int h=sizeof( boost::compressed_pair<std::string, boost::compressed_pair<std::string, Empty2> >); //ok

cc1plus: warnings being treated as errors
In file included from ..../boost/boost_1_50_0/include/boost/compressed_pair.hpp:21,
                 from /home/w461845/src/edgamm/src/lib/libLogger/include/libLogger/LogChain.hpp:4,
                 from OLogTest.cpp:1:
..../boost/boost_1_50_0/include/boost/detail/compressed_pair.hpp: In instantiation of "boost::details::compressed_pair_imp<Empty1, boost::compressed_pair<Empty1, Empty2>, 3>":
..../boost/boost_1_50_0/include/boost/detail/compressed_pair.hpp:348: instantiated from "boost::compressed_pair<Empty1, boost::compressed_pair<Empty1, Empty2> >"
OLogTest.cpp:112: instantiated from here
..../boost/boost_1_50_0/include/boost/detail/compressed_pair.hpp:73: error: direct base "Empty1" inaccessible in "boost::details::compressed_pair_imp<Empty1, boost::compressed_pair<Empty1, Empty2>, 3>" due to ambiguity

g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4)

Chris Hite

This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sale of securities, accuracy and completeness of information, viruses, confidentiality, legal privilege, and legal entity disclaimers, available at

Boost list run by bdawes at, gregod at, cpdaniel at, john at