https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119463
Bug ID: 119463 Summary: Wrong diagnostics about unnecessary parentheses or acceptance of invalid code Product: gcc Version: 14.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: fchelnokov at gmail dot com Target Milestone: --- This valid program ``` using A = int; struct B { int b; }; A(::B::* x) = &B::b; ``` makes GCC emit the > warning: unnecessary parentheses in declaration of 'x' [-Wparentheses] > note: remove parentheses > 3 | A(::B::* x) = &B::b; > | ^~~~~~~~~~ Online demo: https://gcc.godbolt.org/z/easrY9sdo However, it looks wrong, since if the parentheses are removed: ``` using A = int; struct B { int b; }; A::B::* x = &B::b; ``` then the program is rejected by Clang, EDG and MSVC, but GCC accepts it just fine (found by my Ńolleague Egor). Online demo: https://gcc.godbolt.org/z/aPsn7Wsxb