Under clause 17 Library introduction:
17.5.2.3 Private members [objects.within.classes]
1 - Clauses 18 through 30 and Annex D do not specify the representation of classes, and intentionally omit specification of class members. An implementation may define static or non-static class members, or both, as needed to implement the semantics of the member functions specified in Clauses 18 through 30 and Annex D.
This is supported by 1.4 Implementation compliance [intro.compliance]:
3 - For classes and class templates, the library Clauses specify partial definitions. Private members (Clause 11) are not specified, but each implementation shall supply them to complete the definitions according to the description in the library Clauses.
Implementing specified semantics through inheritance is not explicitly discussed anywhere in clause 17, but it is implicitly permitted through paragraph 3 of 17.5.2.3 above:
3 - An implementation may use any technique that provides equivalent external behavior.
This is how, for example, the node-based ordered associative containers can share implementation detail (including, eventually, class members) through inheritance.
Since the external behaviour of tuple
is changed between having A
as a class member and directly inheriting it, and since this change of behaviour causes the rejection of otherwise well-formed programs (as opposed to just changing the sizeof
of a class), libstdc++ is in violation of the Standard.
std::tuple
object, so that there's no spurious conversion. – Spanntuple
that require compiler dedicated assistance, though one could defer to the compiler for ease obviously. It seems therefore that this would be a library issue, what is unclear is whether this is prohibited or a "hole" in the Standard (it certainly seem unintended). – Inadvertence