使用带成员函数指针的decltype

Nub*_*ase 9 c++ templates visual-studio-2010 visual-studio c++11

我在使用decltype成员函数指针时遇到了一些麻烦:

#include <iostream>
#include <type_traits>

struct A
{
    void func1() {}
    typedef decltype(&A::func1) type;
};

int wmain(int argc, wchar_t* argv[])
{
    typedef decltype(&A::func1) type;

    //Case 1
    std::wcout
        << std::boolalpha
        << std::is_member_function_pointer<type>::value
        << std::endl;

    //Case 2
    std::wcout
        << std::boolalpha
        << std::is_member_function_pointer<A::type>::value
        << std::endl;

    system("pause");
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

案例1 true按预期打印,但案例2打印false.

被decltype剥离了一种类型的"成员"属性?如果是这样,为什么?

另外,有没有办法防止这种行为?无论我在哪里使用,我都需要获取成员函数的类型decltype.

请帮忙.

编辑:

向微软报道

Nic*_*las 3

为了正式起见(回答问题),这似乎是 VC2010 编译器中的一个错误。提交错误报告,以便 Microsoft 可以在下一版本中修复它。