https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95744
Bug ID: 95744 Summary: Duplicate error message in a simple decltype specifier Product: gcc Version: 11.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: haoxintu at gmail dot com CC: mpolacek at gcc dot gnu.org, redi at gcc dot gnu.org Target Milestone: --- The test.cc includes a very simple valid decltype specifier with an undeclared variable(I am definitely sure), but GCC emits two duplicated error messages on it. $cat test.cc decltype(var) i = 100; $g++-trunk -c -w test.cc test.cc:1:10: error: ‘var’ was not declared in this scope 1 | decltype(var) i = 100; | ^~~ test.cc:1:10: error: ‘var’ was not declared in this scope While in clang $clang++ -c -w test.cc test.cc:1:10: error: use of undeclared identifier 'var' decltype(var) i = 100; ^ 1 error generated. My GCC version is $g++-trunk --version g++ (GCC) 11.0.0 20200605 (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.