[libcxx-commits] [libcxx] [libc++][format] Don't treat a closing '}' as part of format-spec (PR #81305)

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Sun Feb 11 05:59:12 PST 2024


================
@@ -83,13 +84,16 @@ class _LIBCPP_TEMPLATE_VIS basic_format_parse_context {
       std::__throw_format_error("Argument index outside the valid range");
   }
 
+  _LIBCPP_HIDE_FROM_ABI constexpr bool& __should_parse() { return __parse_; }
+
 private:
   iterator __begin_;
   iterator __end_;
   enum _Indexing { __unknown, __manual, __automatic };
   _Indexing __indexing_;
   size_t __next_arg_id_;
   size_t __num_args_;
+  bool __parse_;
----------------
mordante wrote:

FYI this (likely) changes the size of a public type which results in an ABI break. This is something that we should try very hard to avoid. A possible solution would be to use an unused bit of `__indexing_` or other padding bits. With the proposed approach we don't need this boolean, I just wanted to mention this generic Standard library rule.

https://github.com/llvm/llvm-project/pull/81305


More information about the libcxx-commits mailing list