如何修复lib libstdc ++的`std :: variant`(来自GCC 9.1)在Clang 8中不起作用?

时间:2019-06-06 21:30:59

标签: c++ clang clang++ libstdc++

MSYS2的GCC软件包最近更新至9.1,但是Clang不喜欢它随附的新SELECT DimCombinationID FROM dimcombinations GROUP BY DimCombinationID HAVING SUM( (Dim = '100' AND DimValue = '395') OR (Dim = '600' AND DimValue = '342') OR (Dim = '900' AND DimValue = '281') ) = 3 AND COUNT(*) = 3 libstdc ++头文件。

在编译以下简单程序时:

<variant>

我得到:

#include <variant>

int main()
{
    std::variant<int, float> x;
}

Here is the complete <variant> header if you want to look at it.

在等待正式修复的同时,我按照Clang的建议进行了操作,并在标题中添加了# clang++ -std=c++17 foo.cpp In file included from foo.cpp:1: Z:\...\msys2\mingw64\include\c++\9.1.0\variant:1559:55: error: '__get' is missing exception specification 'noexcept' friend constexpr decltype(auto) __detail::__variant::__get(_Vp&& __v); ^ foo.cpp:5:30: note: in instantiation of template class 'std::variant<int, float>' requested here std::variant<int, float> x; ^ Z:\...\msys2\mingw64\include\c++\9.1.0\variant:263:5: note: previous declaration is here __get(_Variant&& __v) noexcept ^ 1 error generated.

到目前为止,它似乎可以正常工作。

此解决方案可以引起任何问题吗?我还应该做点其他事情吗?

如果您知道它是libstdc ++错误还是Clang错误,则奖励积分。

1 个答案:

答案 0 :(得分:2)

此修复程序正确。这是一个libstdc ++错误,请参见https://bugs.llvm.org/show_bug.cgi?id=41863https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90397