https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95658
Bug ID: 95658 Summary: Bogus duplicate error message in "decltype(auto)" type specifier Product: gcc Version: 9.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: haoxintu at gmail dot com Target Milestone: --- This code bug.cc in GCC 8.1 - 9.3 gives the bogus duplicate error messages. $cat bug.cc decltype (auto) var = 0; Take GCC-9, GCC-10, GCC-trunk for example, $g++-9 -c -std=c++11 bug.cc bug.cc:1:11: error: expected primary-expression before ‘auto’ 1 | decltype (auto) var = 0; | ^~~~ bug.cc:1:11: error: expected ‘)’ before ‘auto’ 1 | decltype (auto) var = 0; | ~^~~~ | ) bug.cc:1:11: error: expected primary-expression before ‘auto’ 1 | decltype (auto) var = 0; | ^~~~ bug.cc:1:11: error: expected primary-expression before ‘auto’ bug.cc:1:11: error: expected primary-expression before ‘auto’ bug.cc:1:11: error: expected primary-expression before ‘auto’ bug.cc:1:1: error: expected unqualified-id before ‘decltype’ 1 | decltype (auto) var = 0; | ^~~~~~~~ $g++-10 -c -std=c++11 bug.cc bug.cc:1:11: error: expected primary-expression before ‘auto’ 1 | decltype (auto) var = 0; | ^~~~ $g++-trunk -c -std=c++11 bug.cc bug.cc:1:11: error: expected primary-expression before ‘auto’ 1 | decltype (auto) var = 0; | ^~~~ GCC versions I used are $g++-9 --version g++-9 (Ubuntu 9.3.0-11ubuntu0~18.04.1) 9.3.0 Copyright (C) 2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $g++-10 --version g++-10 (Ubuntu 10.1.0-2ubuntu1~18.04) 10.1.0 Copyright (C) 2020 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $g++-trunk --version g++ (GCC) 11.0.0 20200526 (experimental) Copyright (C) 2020 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.