noexcept of a function returning a class having throwing destructor

Viewed 139

In the following code, I thought that the assertion shouldn't fire but it does.

struct A
{
  ~A() noexcept(false);
};

A f() noexcept;

int main()
{
  static_assert(noexcept(f()), "f must be noexcept");
}

The function f() is noexcept obviously, but noexcept(f()) is evaluated to false. (in both of gcc and clang)

Am i missing something or is it a bug?

1 Answers
Related