ICU-20138 Copy fErrorCode in FormattedValue subclass macro.
diff --git a/icu4c/source/i18n/formattedval_impl.h b/icu4c/source/i18n/formattedval_impl.h
index e6aa49c..d3b49ec 100644
--- a/icu4c/source/i18n/formattedval_impl.h
+++ b/icu4c/source/i18n/formattedval_impl.h
@@ -63,9 +63,10 @@
/** Implementation of the methods from U_FORMATTED_VALUE_SUBCLASS_AUTO. */
#define UPRV_FORMATTED_VALUE_SUBCLASS_AUTO_IMPL(Name) \
Name::Name(Name&& src) U_NOEXCEPT { \
- delete fData; \
fData = src.fData; \
src.fData = nullptr; \
+ fErrorCode = src.fErrorCode; \
+ src.fErrorCode = U_INVALID_STATE_ERROR; \
} \
Name::~Name() { \
delete fData; \
@@ -75,6 +76,8 @@
delete fData; \
fData = src.fData; \
src.fData = nullptr; \
+ fErrorCode = src.fErrorCode; \
+ src.fErrorCode = U_INVALID_STATE_ERROR; \
return *this; \
} \
UnicodeString Name::toString(UErrorCode& status) const { \