https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66699

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |msebor at gcc dot gnu.org

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
Since the layout of std::pair members is fully specified, so is the order of
their initialization and destruction.  The output of the test case reflects
this order.

The order of initialization (and destruction) of std:stuple subobjects is less
clearly specified.  At least it's not immediately obvious from my reading of
the spec if any particular order is required.

The reason why the output for std::tuple with libstdc++ is the reverse of
std::pair is because the implementation, which relies on recursive inheritance,
 stores and constructs tuple elements in the reverse order: i.e., the base
class, which stores the last element, is stored and constructed first, followed
by each derived class (each of which stores the last - Nth element).

Reply via email to