https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96110
Bug ID: 96110
Summary: Function declarator with a trailing return type "auto"
should be allowed in try-catch block
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: haoxintu at gmail dot com
Target Milestone: ---
Hi, all.
The code test.cc
int main(){
try {}
catch (auto foo() -> auto) {}
return 0;
}
might should be allowed in GCC.
$g++ test.cc
test.cc: In function 'int main()':
test.cc:8:12: error: 'auto' parameter not permitted in this context
8 | catch (auto foo() -> auto) {}
| ^~~~
Other compilers, clang, or icc accepts this well.
All versions from 6.1 to trunk behave the same.
Thanks,
Haoxin