Absence of compilation error when using parametrized constructor
问题 Today at work I came across a behavior in C++ which I don't understand. I have produced the following example code to illustrate my problem: #include <string> #include <iostream> class MyException { public: MyException(std::string s1) {std::cout << "MyException constructor, s1: " << s1 << std::endl;} }; int main(){ const char * text = "exception text"; std::cout << "Creating MyException object using std::string(const char *)." << std::endl; MyException my_ex(std::string(text)); std::cout <<