diff --git a/libcxx/include/__format/buffer.h b/libcxx/include/__format/buffer.h --- a/libcxx/include/__format/buffer.h +++ b/libcxx/include/__format/buffer.h @@ -16,6 +16,7 @@ #include <__algorithm/min.h> #include <__algorithm/transform.h> #include <__algorithm/unwrap_iter.h> +#include <__availability> #include <__config> #include <__format/concepts.h> #include <__format/enable_insertable.h> @@ -50,7 +51,7 @@ /// type-erasure for the formatting functions. This reduces the number to /// template instantiations. template <__fmt_char_type _CharT> -class _LIBCPP_TEMPLATE_VIS __output_buffer { +class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __output_buffer { public: using value_type = _CharT; @@ -223,7 +224,7 @@ /// This storage is used when writing a single element to the output iterator /// is expensive. template <__fmt_char_type _CharT> -class _LIBCPP_TEMPLATE_VIS __internal_storage { +class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __internal_storage { public: _LIBCPP_HIDE_FROM_ABI _CharT* __begin() { return __buffer_; } @@ -239,7 +240,7 @@ /// Since the output is directly written to the underlying storage this class /// is just an empty class. template <__fmt_char_type _CharT> -class _LIBCPP_TEMPLATE_VIS __direct_storage {}; +class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __direct_storage {}; template concept __enable_direct_output = __fmt_char_type<_CharT> && @@ -251,7 +252,7 @@ /// Write policy for directly writing to the underlying output. template -class _LIBCPP_TEMPLATE_VIS __writer_direct { +class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __writer_direct { public: _LIBCPP_HIDE_FROM_ABI explicit __writer_direct(_OutIt __out_it) : __out_it_(__out_it) {} @@ -270,7 +271,7 @@ /// Write policy for copying the buffer to the output. template -class _LIBCPP_TEMPLATE_VIS __writer_iterator { +class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __writer_iterator { public: _LIBCPP_HIDE_FROM_ABI explicit __writer_iterator(_OutIt __out_it) : __out_it_{_VSTD::move(__out_it)} {} @@ -300,18 +301,18 @@ /// Extract the container type of a \ref back_insert_iterator. template -struct _LIBCPP_TEMPLATE_VIS __back_insert_iterator_container { +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __back_insert_iterator_container { using type = void; }; template <__insertable _Container> -struct _LIBCPP_TEMPLATE_VIS __back_insert_iterator_container> { +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __back_insert_iterator_container> { using type = _Container; }; /// Write policy for inserting the buffer in a container. template -class _LIBCPP_TEMPLATE_VIS __writer_container { +class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __writer_container { public: using _CharT = typename _Container::value_type; @@ -330,7 +331,7 @@ /// Selects the type of the writer used for the output iterator. template -class _LIBCPP_TEMPLATE_VIS __writer_selector { +class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __writer_selector { using _Container = typename __back_insert_iterator_container<_OutIt>::type; public: @@ -341,7 +342,7 @@ /// The generic formatting buffer. template -requires(output_iterator<_OutIt, const _CharT&>) class _LIBCPP_TEMPLATE_VIS +requires(output_iterator<_OutIt, const _CharT&>) class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __format_buffer { using _Storage = conditional_t<__enable_direct_output<_OutIt, _CharT>, @@ -377,7 +378,7 @@ /// Since \ref formatted_size only needs to know the size, the output itself is /// discarded. template <__fmt_char_type _CharT> -class _LIBCPP_TEMPLATE_VIS __formatted_size_buffer { +class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __formatted_size_buffer { public: _LIBCPP_HIDE_FROM_ABI auto __make_output_iterator() { return __output_.__make_output_iterator(); } @@ -397,7 +398,7 @@ /// The base of a buffer that counts and limits the number of insertions. template requires(output_iterator<_OutIt, const _CharT&>) -struct _LIBCPP_TEMPLATE_VIS __format_to_n_buffer_base { +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __format_to_n_buffer_base { using _Size = iter_difference_t<_OutIt>; public: @@ -427,7 +428,7 @@ /// exceed the maximum number of code units. template requires(output_iterator<_OutIt, const _CharT&>) -class _LIBCPP_TEMPLATE_VIS __format_to_n_buffer_base<_OutIt, _CharT, true> { +class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __format_to_n_buffer_base<_OutIt, _CharT, true> { using _Size = iter_difference_t<_OutIt>; public: @@ -477,7 +478,7 @@ /// The buffer that counts and limits the number of insertions. template requires(output_iterator<_OutIt, const _CharT&>) -struct _LIBCPP_TEMPLATE_VIS __format_to_n_buffer final +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __format_to_n_buffer final : public __format_to_n_buffer_base< _OutIt, _CharT, __enable_direct_output<_OutIt, _CharT>> { using _Base = __format_to_n_buffer_base<_OutIt, _CharT, __enable_direct_output<_OutIt, _CharT>>; using _Size = iter_difference_t<_OutIt>; @@ -492,6 +493,7 @@ return {_VSTD::move(this->__writer_).__out_it(), this->__size_}; } }; + } // namespace __format #endif //_LIBCPP_STD_VER > 17 diff --git a/libcxx/include/__format/format_arg.h b/libcxx/include/__format/format_arg.h --- a/libcxx/include/__format/format_arg.h +++ b/libcxx/include/__format/format_arg.h @@ -140,7 +140,7 @@ /// This is a separate type so it's possible to store the values and types in /// separate arrays. template -class __basic_format_arg_value { +class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __basic_format_arg_value { using _CharT = typename _Context::char_type; public: @@ -251,7 +251,7 @@ }; template -class _LIBCPP_TEMPLATE_VIS basic_format_arg<_Context>::handle { +class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT basic_format_arg<_Context>::handle { public: _LIBCPP_HIDE_FROM_ABI void format(basic_format_parse_context& __parse_ctx, _Context& __ctx) const { diff --git a/libcxx/include/__format/formatter_floating_point.h b/libcxx/include/__format/formatter_floating_point.h --- a/libcxx/include/__format/formatter_floating_point.h +++ b/libcxx/include/__format/formatter_floating_point.h @@ -16,6 +16,7 @@ #include <__algorithm/min.h> #include <__algorithm/rotate.h> #include <__algorithm/transform.h> +#include <__availability> #include <__concepts/arithmetic.h> #include <__concepts/same_as.h> #include <__config> @@ -132,7 +133,7 @@ /// Depending on the maxium size required for a value, the buffer is allocated /// on the stack or the heap. template -class _LIBCPP_TEMPLATE_VIS __float_buffer { +class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __float_buffer { using _Traits = __traits<_Fp>; public: diff --git a/libcxx/include/__format/parser_std_format_spec.h b/libcxx/include/__format/parser_std_format_spec.h --- a/libcxx/include/__format/parser_std_format_spec.h +++ b/libcxx/include/__format/parser_std_format_spec.h @@ -241,7 +241,7 @@ /// set to zero. That way they can be repurposed if a future revision of the /// Standards adds new fields to std-format-spec. template -class _LIBCPP_TEMPLATE_VIS __parser { +class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __parser { public: _LIBCPP_HIDE_FROM_ABI constexpr auto __parse(basic_format_parse_context<_CharT>& __parse_ctx, __fields __fields) -> decltype(__parse_ctx.begin()) { diff --git a/libcxx/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp b/libcxx/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp --- a/libcxx/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp +++ b/libcxx/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp @@ -253,15 +253,11 @@ test_copy_ctor_valueless_by_exception(); test_copy_ctor_sfinae(); test_constexpr_copy_ctor(); -#if 0 -// disable this for the moment; it fails on older compilers. -// Need to figure out which compilers will support it. -{ // This is the motivating example from P0739R0 - std::variant v1(3); - std::variant v2 = v1; - (void) v2; -} -#endif + { // This is the motivating example from P0739R0 + std::variant v1(3); + std::variant v2 = v1; + (void)v2; + } return 0; }