https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82075
Bug ID: 82075
Summary: structured binding fails with empty base class
Product: gcc
Version: 7.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
struct B { };
struct D : B { int i; };
int main() {
auto [i] = D{};
}
On gcc 7.2, this fails with:
sb.cxx:5:10: error: cannot decompose class type āDā: both it and its base class
āDā have non-static data members
auto [i] = D{};
^~~
But this is well-formed - all of D's non-static data members are public direct
members of D.