Dan M.
Dan M.

Reputation: 4052

Strange stdlib(memory.h) issues with make_shared exclusive to xcode apple clang

I have weird issue which appears only on OSX. (It builds fine on windows with visual studio and on linux with both gcc and clang)/ In my code I have something like:

std::shared_ptr<mythread> ptr = std::make_shared<mythread>(name)

mythread derives from class with noexcept(false) destructor and some basic struct.

apple clang complains: /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

skipped instantiations /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();

How to fix that error and why does it appear (only on osx)? I found something similar as bugs in clang but they were supposed to be fixed in 2011.

Upvotes: 1

Views: 318

Answers (1)

Dan M.
Dan M.

Reputation: 4052

Apparently it didn't like noexcept(false) in parent's destructor for some reason. And couldn't tell it in coherent way. -1 for osx.

Upvotes: 0

Related Questions