I'm writing a exception class with a what() method.

```
const char* what() const throw() {
    return "test";
}

```

works fine, but

```
const char* what() const throw() {
    return (std::string("test")).c_str();
}

```

seems to return a random result. Why?