This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/51365] cannot use final empty class in std::tuple
- 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: Sun, 11 Dec 2011 13:39:20 +0000
- Subject: [Bug libstdc++/51365] cannot use final empty class in std::tuple
- Auto-submitted: auto-generated
- References: <bug-51365-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51365
--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-12-11 13:39:20 UTC ---
I haven't really thought about it either, but one advantage of depending on
is_empty is that it prevents using the EBO for polymorphic classes, where
derivation could have undesirable effects. That *shouldn't* be a problem as
long as user-defined types don't have virtual functions using reserved names
such as _M_get.
Another problem could be user-defined types with a virtual base, if the tuple
node type (which would be the most-derived type) doesn't know how to construct
the virtual base.
struct A { A(int) { } };
struct B : virtual A { B() : A(1) { } };
std::tuple<B> t;
If tuple derived from B it couldn't construct the A subobject correctly.