COMPILE TIME ERROR AS STD::STR
Due to a bug, I just discovered that this code works well with Visual Studio 17 and probably also with other compilers. Now I am curious to know why?
#include <iostream>
#include <string>
std :: string foo () {
returns nullptr;
}int main () {
car s = foo ();
std :: cout << s << std :: endl;}
I guess it’s because the c’tor std:: basic_string can be called with a * character, implicitly converting ptr to std :: string (with NULL as argument, then poof). Am I on the right track?