[Bug c++/94944] compile error accessing member function of dependent base class template in noexcept specification

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Feb 18 01:22:51 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94944

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:36278f48cbc08c78e4ed588e5a049bd45fd1c55a

commit r12-7291-g36278f48cbc08c78e4ed588e5a049bd45fd1c55a
Author: Patrick Palka <ppalka@redhat.com>
Date:   Thu Feb 17 20:20:24 2022 -0500

    c++: implicit 'this' in noexcept-spec within class tmpl [PR94944]

    Here when instantiating the noexcept-spec we fail to resolve the
    implicit object for the member call A<T>::f() ultimately because
    maybe_instantiate_noexcept sets current_class_ptr/ref to the dependent
    'this' (of type B<T>) rather than the specialized 'this' (of type B<int>).

    This patch fixes this by making maybe_instantiate_noexcept set
    current_class_ptr/ref to the specialized 'this' instead, consistent
    with what tsubst_function_type does when substituting into the trailing
    return type of a non-static member function.

            PR c++/94944

    gcc/cp/ChangeLog:

            * pt.cc (maybe_instantiate_noexcept): For non-static member
            functions, set current_class_ptr/ref to the specialized 'this'
            instead.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/noexcept34.C: Adjusted expected diagnostics.
            * g++.dg/cpp0x/noexcept75.C: New test.


More information about the Gcc-bugs mailing list