Consider the following code:
constexpr auto f()
{
auto str = "Hello World!";
return str;
}
int main(int argc, char* argv[])
{
static constexpr auto str = f();
std::cout << str << std::endl;
return 0;
}
Is that normal that my compiler does not display any warning? Is it defined behavior? Do I have the guarantee that the program will display "Hello World!"? I would expect the "Hello World!" not to live beyond the scope of the function...