编译器属性卡在函数类型上——是否有针对此 clang-cl 错误的解决方法?
Compiler attribute stuck on a function type - is there a workaround for this clang-cl bug?
在 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{}; }
微软 Visual Studio 社区 2015
版本 14.0.24720.00 更新 1
我没有找到 VS 2015 Update 1 的解决方法,但这个问题似乎在 VS 2015 Update 2 中得到了解决。
在 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{}; }
微软 Visual Studio 社区 2015 版本 14.0.24720.00 更新 1
我没有找到 VS 2015 Update 1 的解决方法,但这个问题似乎在 VS 2015 Update 2 中得到了解决。