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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
G++ does not give an error for the example in p5:

class A { /* ... */ };
void (*pf1)(); // no exception specification
void (*pf2)() throw(A);

void f() {
  pf1 = pf2; // OK: pf1 is less restrictive
  pf2 = pf1; // error: pf2 is more restrictive
}

That should be ill-formed in C++98/11/14.

The equivalent with a noexcept-specifier would be:

class A { /* ... */ };
void (*pf1)(); // no exception specification
void (*pf2)() noexcept;

void f() {
  pf1 = pf2; // OK: pf1 is less restrictive
  pf2 = pf1; // error: pf2 is more restrictive
}

G++ doesn't reject this in 98/11/14, only C++17 and up.

Reply via email to