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 <jason@redhat.com>
2 files changed