Running into an issue with gcc with c++14. When compiling the code below I get an error
"call of overloaded ‘make_unique(std::__cxx11::string)’ is ambiguous"
However if I remove the local definition of make_unique I also get an error:
"‘make_unique’ was not declared in this scope"
It seems like it should be impossible to get both of these errors as either the std::make_unique is pulled in due to ADL or it is not. Is this just an issue with gcc or is there something else going on?
For reference subbing make_unique for a non-template std function (such as stoi) gets rid of the "not declared in this scope" error which leads me to believe it is an issue with gcc.
#include <string>
#include <memory>
template <typename T, typename... Args>
inline std::unique_ptr<T> make_unique(Args&&... args)
{
return std::unique_ptr<T>( new T(std::forward<Args>(args)...) );
}
struct A
{
A(std::string a){ }
};
int main()
{
auto a = make_unique<A>(std::string());
}