Say I have this code:
#include <string>
using namespace std::literals;
struct A {
A(std::string) { };
};
struct B : A { };
And then construct objects like this:
A a("foo");
B b("foo"s); // fails in clang
B c(A("foo")); // fails in clang
B d("foo"); // fails in clang + gcc
B e({"foo"}); // fails in clang
A f{"foo"};
B g{"foo"s};
B h{A{"foo"}};
B i{"foo"}; // fails in clang + gcc
B j{{"foo"}};
How are a
, b
, c
, ... actually constructed? What conversion, initialization method, constructor actually gets called? And why does it fail?