]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: noexcept-spec from nested class confusion [PR109761]
authorPatrick Palka <ppalka@redhat.com>
Tue, 9 May 2023 19:06:34 +0000 (15:06 -0400)
committerPatrick Palka <ppalka@redhat.com>
Wed, 9 Aug 2023 17:13:11 +0000 (13:13 -0400)
commit60a8421ee457d94880e4dcbb93a663c633f2e96e
tree739822b9f81e21379228c9a004025695963872d2
parent52391dfd69ec57a9664454131cf3a741f4ff7b12
c++: noexcept-spec from nested class confusion [PR109761]

When late processing a noexcept-spec from a nested class after completion
of the outer class (since it's a complete-class context), we pass the wrong
class context to noexcept_override_late_checks -- the outer class type
instead of the nested class type -- which leads to bogus errors in the
below test.

This patch fixes this by making noexcept_override_late_checks obtain the
class context directly via DECL_CONTEXT instead of via an additional
parameter.

PR c++/109761

gcc/cp/ChangeLog:

* parser.c (cp_parser_class_specifier): Don't pass a class
context to noexcept_override_late_checks.
(noexcept_override_late_checks): Remove 'type' parameter
and use DECL_CONTEXT of 'fndecl' instead.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/noexcept78.C: New test.

(cherry picked from commit c13906f258fb34b3e0c90ddc8d9191dd72f3da0e)
gcc/cp/parser.c
gcc/testsuite/g++.dg/cpp0x/noexcept78.C [new file with mode: 0644]