I saw following example here,
#include <iostream>
struct B
{
};
struct D : B
{
int i;
};
int main()
{
auto [i] = D{};
return 0;
}
I have compiled this program with GCC 7.2.0 (C++1Z), and I got following error:
error: cannot decompose class type 'D': both it and its base class 'D' have non-static data members
auto [i] = D{};
^~~
So, Why does structured binding fails with empty base class?
Aucun commentaire:
Enregistrer un commentaire