[libcxx-commits] [PATCH] D65667: [libcxx] Early-initialize error_category singletons
Marshall Clow via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Aug 7 08:29:52 PDT 2019
mclow.lists added a comment.
In D65667#1617900 <https://reviews.llvm.org/D65667#1617900>, @hubert.reinterpretcast wrote:
> In D65667#1617183 <https://reviews.llvm.org/D65667#1617183>, @mclow.lists wrote:
> > Hubert - I'm not following what you're saying.
> > Where did `error_code` come from? As far as I can tell, your comment is the first mention of `error_code` in this conversation.
> Yes, you're correct it is. We encountered this lifetime issue in an application where the reference to the out-of-lifetime object was the `cat_` exposition-only member of `error_code`. The status quo with libc++ is that `error_code`s are likely unsafe to use during program termination.
Thanks for the clarification.
So the situation is:
- You register an `atexit` handler.
- During program termination, your handler is called, and you do something that creates an `error_code` object.
- You try to use the `error_category` of that error code, and discover that it has been destroyed?
Is that correct?
CHANGES SINCE LAST ACTION
More information about the libcxx-commits