This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/56785] std::tuple of two elements does not apply empty base class optimization when one of its elements is a std::tuple with two elements
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 17 Jun 2014 10:22:01 +0000
- Subject: [Bug libstdc++/56785] std::tuple of two elements does not apply empty base class optimization when one of its elements is a std::tuple with two elements
- Auto-submitted: auto-generated
- References: <bug-56785-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56785
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The solution I'm testing is to give every tuple hierarchy a distinct base
class, differentiated by an unused template argument that depends on the types
of all the elements, so the base classes can be at the same address.
The downside is this produces additional instantiations for programs using
different tuple types that have common tails, e.g. tuple<A,B,C> and
tuple<D,B,C> would no longer share any code. Those class instantiation
shouldn't generate much code, so maybe that's not an issue