https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98283
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>: https://gcc.gnu.org/g:e4f1ea5d8b96fc9fbe4fc0e0e0a4938ceeef092f commit r14-560-ge4f1ea5d8b96fc9fbe4fc0e0e0a4938ceeef092f Author: Patrick Palka <ppa...@redhat.com> Date: Sun May 7 11:57:22 2023 -0400 c++: parenthesized -> resolving to static data member [PR98283] Here we're neglecting to propagate parenthesized-ness when the member access (this->m) resolves to a static data member (and thus finish_class_member_access_expr yields a VAR_DECL instead of a COMPONENT_REF). PR c++/98283 gcc/cp/ChangeLog: * pt.cc (tsubst_copy_and_build) <case COMPONENT_REF>: Propagate REF_PARENTHESIZED_P more generally via force_paren_expr. * semantics.cc (force_paren_expr): Document default argument. gcc/testsuite/ChangeLog: * g++.dg/cpp1y/paren6.C: New test.