https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119024
Bug ID: 119024
Summary: Problem of structured binding and maybe gcc 10 accepts
invalid
Product: gcc
Version: 10.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: qurong at ios dot ac.cn
Target Milestone: ---
For this program:
void f() {
int arr[1] = { 1 };
struct A {
};
auto[A] = arr;
auto[B] = arr;
struct B {
};
}
int main() {
f();
return 0;
}
This causes an error in clang and gcc≥11, but msvc and gcc10 didn't report the
error.
Compiler Explorer link: https://godbolt.org/z/9haa76qKG