I'm wondering what the standard says about the following piece of code. Can string
destructor of temporary object be executed before calling printPointer
?
p.s. VS2010 compiler doesn't complain about this code and works correctly.
void printPointer(const string* pointer)
{
cout << *pointer << endl;
}
const string* func(const string& s1)
{
return &s1;
}
int main()
{
printPointer(func("Hello, World!!!"));
}