xcode apple clang 独有的 make_shared 的奇怪 stdlib(memory.h) 问题
Strange stdlib(memory.h) issues with make_shared exclusive to xcode apple clang
我有一个只出现在 OSX 上的奇怪问题。 (它在 windows 和 visual studio 以及 linux 和 gcc 和 clang 上都很好地构建)/
在我的代码中,我有类似的东西:
std::shared_ptr<mythread> ptr = std::make_shared<mythread>(name)
mythread 派生自 class,带有 noexcept(false) 析构函数和一些基本结构。
apple clang 抱怨:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:3686:7: error: exception specification of overriding function is more lax than base version
class __shared_ptr_emplace
跳过实例化
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:3616:13: note: overridden virtual function is here
virtual ~__shared_weak_count();
如何修复该错误以及为什么会出现该错误(仅在 osx 上)?我在 clang 中发现了一些类似于错误的东西,但它们应该在 2011 年修复。
显然,出于某种原因,它不喜欢父级析构函数中的 noexcept(false)。并且无法以连贯的方式讲述它。 -1 对于 osx.
我有一个只出现在 OSX 上的奇怪问题。 (它在 windows 和 visual studio 以及 linux 和 gcc 和 clang 上都很好地构建)/ 在我的代码中,我有类似的东西:
std::shared_ptr<mythread> ptr = std::make_shared<mythread>(name)
mythread 派生自 class,带有 noexcept(false) 析构函数和一些基本结构。
apple clang 抱怨:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:3686:7: error: exception specification of overriding function is more lax than base version
class __shared_ptr_emplace
跳过实例化
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:3616:13: note: overridden virtual function is here
virtual ~__shared_weak_count();
如何修复该错误以及为什么会出现该错误(仅在 osx 上)?我在 clang 中发现了一些类似于错误的东西,但它们应该在 2011 年修复。
显然,出于某种原因,它不喜欢父级析构函数中的 noexcept(false)。并且无法以连贯的方式讲述它。 -1 对于 osx.