From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DFC37384841E; Tue, 25 May 2021 09:01:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DFC37384841E From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/100752] New: [11/12 Regression] Date: Tue, 25 May 2021 09:01:37 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 11.1.1 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 May 2021 09:01:38 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100752 Bug ID: 100752 Summary: [11/12 Regression] Product: gcc Version: 11.1.1 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org CC: jason at gcc dot gnu.org Target Milestone: --- As noted in Bug 52869 comment 20, this has started to fail: struct S { void f() noexcept {} S &g() noexcept(noexcept(f())) { f(); return *this; } }; noex.C:4:32: error: cannot call member function =E2=80=98void S::f()=E2=80= =99 without object 4 | S &g() noexcept(noexcept(f())) { f(); return *this; } | ^ It started with r11-289: c++: Use of 'this' in parameter declaration [PR90748] We were incorrectly accepting the use of 'this' at parse time and then crashing when we tried to instantiate it. It is invalid because 'this'= is not in scope until after the function-cv-quals. So let's hoist setting current_class_ptr up from cp_parser_late_return_type_opt into cp_parser_direct_declarator where it can work for noexcept as well. PR c++/90748 * parser.c (inject_parm_decls): Set current_class_ptr here. (cp_parser_direct_declarator): And here. (cp_parser_late_return_type_opt): Not here. (cp_parser_noexcept_specification_opt): Nor here. (cp_parser_exception_specification_opt) (cp_parser_late_noexcept_specifier): Remove unneeded parameters= .=