https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96119
Bug ID: 96119 Summary: GCC accepts invalid qualifier in a try-catch block Product: gcc Version: 11.0 Status: UNCONFIRMED Keywords: accepts-invalid Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: haoxintu at gmail dot com Target Milestone: --- Hi, all. This code might be an invalid code, but GCC accepts this well. $cat test.cc int main(){ try {} catch (int () & ){} return 0; } While in Clang, it says: error: non-member function cannot have '&' qualifier In ICC: error: a ref-qualifier is not allowed here All GCC versions from 5.1 to trunk behave the same. Is this also an invalid code for GCC or is there something I misunderstanding? Thanks, Haoxin