I am no longer able to build my C++ project after coming back to it after a while (I've since updated macOS and Xcode), either from Xcode or by calling clang on the command line. I am getting an error on every use of std::shared_ptr::make_shared in my code. I want to emphasize this used to compile and run fine and I don't understand what has changed. Perhaps updating xcode broke my toolchain somehow.
I have reproduced the problem in some very trivial code that I believe should compile fine:
#include <string>
#include <memory>
class test_c {
private:
std::string str_;
public:
test_c(std::string str__) : str_(str__) { }
};
std::string test_s = "test";
auto test = std::shared_ptr<test_c>::make_shared(test_s);
The errors look like this:
$ clang -std=c++14 test.cpp
test.cpp:10:38: error: no member named 'make_shared' in 'std::__1::shared_ptr<test_c>'
auto test = std::shared_ptr<test_c>::make_shared(test_s);
~~~~~~~~~~~~~~~~~~~~~~~~~^
1 error generated.