[Bug c++/86233] A tricky code sample

2018-06-20 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86233

--- Comment #1 from Jonathan Wakely  ---
*** Bug 86230 has been marked as a duplicate of this bug. ***

[Bug c++/86233] A tricky code sample

2018-06-20 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86233

Jonathan Wakely  changed:

   What|Removed |Added

   Keywords||accepts-invalid
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-06-20
 Ever confirmed|0   |1

--- Comment #2 from Jonathan Wakely  ---
I can't find the relevant standarese but I think the code should be rejected
because the specialization has a weaker exception-specification.

Reduced:

template struct X {
  void f() noexcept { }
};

template<> void X::f() { }


EDG says:

"es.cc", line 5: error: allowing all exceptions is incompatible with function
  "X::f" (declared at line 2)
  template<> void X::f() { }
  ^

1 error detected in the compilation of "es.cc".


Clang says:

es.cc:5:25: error: 'f' is missing exception specification 'noexcept'
template<> void X::f() { }
^
noexcept
es.cc:2:8: note: previous declaration is here
  void f() noexcept { }
   ^
1 error generated.