https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108587
Bug ID: 108587
Summary: `decltype(x) x;` in struct declaration causes "changes
meaning of" error
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: mserdarsanli at gmail dot com
Target Milestone: ---
Godbolt link: https://godbolt.org/z/rjEGPKcE7
void fine() {
int x;
struct {
int x;
} v = {
.x = x,
};
}
void not_fine() {
int x;
struct {
decltype(x) x; // error: declaration of 'int not_fine()::<unnamed
struct>::x' changes meaning of 'x' [-fpermissive]
} v = {
.x = x,
};
}