mercredi 30 janvier 2019

std::is_member_function_pointer not working for noexcept member functions

I am having trouble with std::is_member_function_pointer. As far as I can tell, it's not working when given a noexcept member function. I cannot find anything in the standard declaring that it does not work for noexcept qualified member functions. Example of the problem:

#include <type_traits>

class A {
public:
    void member() noexcept { }
};

int main()
{
    // fails at compile time if A::member is a data member and not a function
    static_assert(std::is_member_function_pointer<decltype(&A::member)>::value,
                  "A::member is not a member function."); 
}

It gives me the following error:

member.cpp:11:5: error: static_assert failed due to requirement 'std::is_member_function_pointer::value' "A::member is not a member function." static_assert(std::is_member_function_pointer::value, ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated.

If I remove the noexcept qualification it compiles as it should.

This has been tested on Debian Stretch, using clang 6.0 and libstdc++ 6.3.0 Am I missing something here? From what I can read, this should work.

Aucun commentaire:

Enregistrer un commentaire