[Bug libstdc++/87822] [6/7/8/9 Regression] Binary incompatibility in std::pair introduced by PR 86751
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Oct 31 13:17:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87822
--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Wed Oct 31 13:16:10 2018
New Revision: 265683
URL: https://gcc.gnu.org/viewcvs?rev=265683&root=gcc&view=rev
Log:
PR libstdc++/87822 fix layout change for nested std::pair
The introduction of the empty __pair_base base class for PR 86751
changed the layout of std::pair<std::pair<...>, ...>. The outer pair and
its first member both have a base class of the same type, which cannot
exist at the same address. This causes the first member to be at a
non-zero offset.
The solution is to make the base class depend on the template
parameters, so that each pair type has a different base class type,
which allows the base classes of the outer pair and its first member to
have the same address.
PR libstdc++/87822
* include/bits/stl_pair.h (__pair_base): Change to class template.
(pair): Make base class type depend on template parameters.
* testsuite/20_util/pair/87822.cc: New test.
Added:
branches/gcc-7-branch/libstdc++-v3/testsuite/20_util/pair/87822.cc
Modified:
branches/gcc-7-branch/libstdc++-v3/ChangeLog
branches/gcc-7-branch/libstdc++-v3/include/bits/stl_pair.h
More information about the Gcc-bugs
mailing list