Date
2013-05-03.00:00:00
Message id
4301

Content

The current specification is not clear whether the exception-specification for a function is propagated to the result of taking its address. For example:

  template<class T> struct A {
    void f() noexcept(false) {}
    void g() noexcept(true) {}
  };

  int main() {
    if (noexcept((A<short>().*(&A<short>::f))()))
      return 1;

    if (!noexcept((A<long>().*(&A<long>::g))()))
      return 1;

     return 0;
  }

There is implementation variance on whether main returns 0 or 1 for this example. (It also appears that taking the address of a member function of a class template requires instantiating its exception-specification, but it is not clear whether the Standard currently specifies this or not.)

(See also issues 92 and 1351.)