编译器属性停留在函数类型上 - 这个clang-cl错误是否有解决方法?

时间:2016-03-16 03:36:34

标签: c++ templates visual-studio-2015 calling-convention clang-cl

在Visual Studio 2015中使用C ++ LLVM-vs2014配置时,此静态断言失败。断言在clang ++,gcc甚至Visual C ++中都不会失败。 thiscall属性卡在函数类型上,即使它不再适用。我已经提交了错误报告,但我想知道在此期间是否有办法强行删除该属性。可以删除thiscall吗?

#include <type_traits>

template<typename T>
struct remove_member_pointer;

template<typename T, typename U>
struct remove_member_pointer<T U::*> {
    using type = T;
};

struct foo;

using input = void(foo::*)();
using expect = void();
using result = typename remove_member_pointer<input>::type;

//This static_assert fails because there is a
//compiler-generated attribute left behind, making
//the type of result actually `void () __attribute__((thiscall))`
static_assert(std::is_same<result, expect>{}, "");

int main() { return{}; }

Microsoft Visual Studio社区2015 版本14.0.24720.00更新1

1 个答案:

答案 0 :(得分:0)

我没有找到VS 2015 Update 1的解决方法,但这个问题确实在VS 2015 Update 2中得到修复。