From dea6034c66c1fee04d4b81d130a25ae6eb533efc Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Tue, 18 Jun 2024 14:08:39 -0700 Subject: [PATCH] Fix MSVC compilation errors --- .../i18n/messageformat2_formattable.cpp | 1 - .../i18n/unicode/messageformat2_formattable.h | 75 +++++++++---------- 2 files changed, 37 insertions(+), 39 deletions(-) diff --git a/icu4c/source/i18n/messageformat2_formattable.cpp b/icu4c/source/i18n/messageformat2_formattable.cpp index ce3206827bc..fe8082bdd09 100644 --- a/icu4c/source/i18n/messageformat2_formattable.cpp +++ b/icu4c/source/i18n/messageformat2_formattable.cpp @@ -234,7 +234,6 @@ namespace message2 { return tz; } - DateFormat* defaultDateTimeInstance(const Locale& locale, UErrorCode& errorCode) { NULL_ON_ERROR(errorCode); LocalPointer df(DateFormat::createDateTimeInstance(DateFormat::SHORT, DateFormat::SHORT, locale)); diff --git a/icu4c/source/i18n/unicode/messageformat2_formattable.h b/icu4c/source/i18n/unicode/messageformat2_formattable.h index 15690491089..04cfa73eeec 100644 --- a/icu4c/source/i18n/unicode/messageformat2_formattable.h +++ b/icu4c/source/i18n/unicode/messageformat2_formattable.h @@ -67,44 +67,6 @@ namespace message2 { virtual ~FormattableObject(); }; // class FormattableObject - struct DateInfo; - class Formattable; -} // namespace message2 - -U_NAMESPACE_END - -/// @cond DOXYGEN_IGNORE -// Export an explicit template instantiation of the std::variant that is used -// to represent the message2::Formattable class. -// (When building DLLs for Windows this is required.) -// (See measunit_impl.h, datefmt.h, collationiterator.h, erarules.h and others -// for similar examples.) -#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN -#if defined(U_REAL_MSVC) && defined(_MSVC_STL_VERSION) -template class U_I18N_API std::_Variant_storage_>; -#endif -typedef std::pair P; -template class U_I18N_API std::variant; -#endif -/// @endcond - -U_NAMESPACE_BEGIN - -namespace message2 { - /** * The `DateInfo` struct represents all the information needed to * format a date with a time zone. It includes an absolute date and a time zone name, @@ -149,6 +111,43 @@ namespace message2 { TimeZone* createTimeZone(UErrorCode& status) const; }; + class Formattable; +} // namespace message2 + +U_NAMESPACE_END + +/// @cond DOXYGEN_IGNORE +// Export an explicit template instantiation of the std::variant that is used +// to represent the message2::Formattable class. +// (When building DLLs for Windows this is required.) +// (See measunit_impl.h, datefmt.h, collationiterator.h, erarules.h and others +// for similar examples.) +#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN +#if defined(U_REAL_MSVC) && defined(_MSVC_STL_VERSION) +template class U_I18N_API std::_Variant_storage_>; +#endif +typedef std::pair P; +template class U_I18N_API std::variant; +#endif +/// @endcond + +U_NAMESPACE_BEGIN + +namespace message2 { + /** * The `Formattable` class represents a typed value that can be formatted, * originating either from a message argument or a literal in the code.