[libcxx-commits] [PATCH] D65667: [libcxx] Avoid destructor call for error_category singletons

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Apr 24 09:37:52 PDT 2022


ldionne added inline comments.


================
Comment at: libcxx/src/future.cpp:65
 {
-    static __future_error_category __f;
-    return __f;
+#if defined(_LIBCPP_ERROR_CATEGORY_DEFINE_LEGACY_INLINE_FUNCTIONS)
+   union FutureErrorHelper {
----------------
Is there a reason why you can't simply use the `#else` branch all the time, and never define `_LIBCPP_ERROR_CATEGORY_DEFINE_LEGACY_INLINE_FUNCTIONS` in this translation unit (the same applies to other changes)?

My memory is blurry from being on vacation, but I think the intent of my D123519 was that you could always assume that `error_category` is `constexpr` friendly when building the library.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65667/new/

https://reviews.llvm.org/D65667



More information about the libcxx-commits mailing list