[libc++] Better std::string exception messages

Not sure if this is the right place to post stuff like this, so feel free to redirect me.

I’ve noticed that libc++ std::string exception messages are very basic compared to other standard libraries (eg libstdc++), with (as far as I can tell) everything throwing the exception message “basic string”.

Location where this message comes from: https://github.com/llvm-mirror/libcxx/blob/da6e915c73f231074dc88f8a952a8273da0ca06b/include/string#L609-L616

Example code:

int main(int argc, char** argv) {

try {

std::string().at(1);

} catch (const std::out_of_range &e) {

printf(“e.what is: %s\n”, e.what());

}

}

-stdlib=libc++: e.what is: basic_string

-stdlib=libstdc++: e.what is: basic_string::at: __n (which is 1) >= this->size() (which is 0)

Tim

Forwarding this to libcxx-dev (moving cfe-dev to BCC)