[cfe-dev] [libc++] Better std::string exception messages
LANDER Tim via cfe-dev
cfe-dev at lists.llvm.org
Wed Jan 29 19:59:15 PST 2020
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++<http://coliru.stacked-crooked.com/a/2c7b3070dd82eb7c>: e.what is: basic_string
-stdlib=libstdc++<http://coliru.stacked-crooked.com/a/36d1729322573a69>: e.what is: basic_string::at: __n (which is 1) >= this->size() (which is 0)
Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20200130/4a7d3411/attachment.html>
More information about the cfe-dev
mailing list