[Bug c++/103653] New: GCC rejected int x = 0; auto(x); in C++23
hewillk at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Dec 10 17:09:10 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103653
Bug ID: 103653
Summary: GCC rejected int x = 0; auto(x); in C++23
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: hewillk at gmail dot com
Target Milestone: ---
int main() {
int x = 0;
auto(x);
}
Should this work? GCC rejects it with:
<source>:3:3: error: declaration of 'auto x' has no initializer
3 | auto(x);
| ^~~~
Isn't this using auto to decay-copy the variable x? Please correct me if I am
wrong.
https://godbolt.org/z/TxorTr56o
More information about the Gcc-bugs
mailing list