Open llvmbot opened 6 years ago
Also this problem affected on all standard library. Example:
struct foo { void boo() noexcept {} } foo_;
int main() { static_assert(noexcept(std::memfn(&foo::boo)(foo)), "it's bad"); return 0; }
I don't think this is a bug and Clang is perfectly conforming here. This is a design change in C++17, see P0012R1.
Extended Description
This happens only with -std=c++14 and -std=c++11 flags, but with -std=c++1z flag is all good.
Link to wandbox demonstration: https://wandbox.org/permlink/xHdPq2R0deTqQ6KG
struct foo { void boo() noexcept {} } foo_;
template < typename F > void should_be_noexcept(F f, foo& t) noexcept(noexcept((t.f)())) { (t.f)(); }
int main() { void (foo::f)() noexcept = &foo::boo; staticassert(noexcept((foo.f)()), "%-)"); // 1 safe noexcept static_assert(noexcept(should_benoexcept(&foo::boo, foo)), "no :-("); // 2 miss noexcept return 0; }