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

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <[email protected]>:

https://gcc.gnu.org/g:53efe2f8d66bb6344d084ca731cdec56873c62a0

commit r17-1624-g53efe2f8d66bb6344d084ca731cdec56873c62a0
Author: Marek Polacek <[email protected]>
Date:   Fri Jun 5 13:42:06 2026 -0400

    c++: explicit instantiation and noexcept-specifier [PR125613]

    This patch implements this part of [except.spec]: In an explicit
    instantiation a noexcept-specifier may be specified, but is not required.
    If a noexcept-specifier is specified in an explicit instantiation, the
    exception specification shall be the same as the exception specification
    of all other declarations of that function.

    But we are not checking this, and are the only compiler that accepts:

      template<typename T>
      void fn (T) {}
      template void fn<int>(int) noexcept;

            PR c++/125613

    gcc/cp/ChangeLog:

            * pt.cc (check_explicit_specialization): Detect mismatches in
            exception specifications in explicit instantiations.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/explicit-inst2.C: New test.

    Reviewed-by: Jason Merrill <[email protected]>

Reply via email to