Why implicit conversion from const char* to std::string does not work in the latter case?
Link a reference to C++ standard if possible, please.
Variant 1:
struct Foo {
Foo(const char* a) {}
};
int main() {
// works well for a "const char*" accepting constructor
Foo* foo = new Foo[1] { "a" };
}
Variant 2:
struct Foo {
Foo(std::string a) {}
};
int main() {
// could not convert from "const char*" to "Foo"
Foo* foo = new Foo[1] { "a" };
}