summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--icu4c/source/i18n/messageformat2_errors.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/icu4c/source/i18n/messageformat2_errors.cpp b/icu4c/source/i18n/messageformat2_errors.cpp
index 48fa17a79..cbb9e1497 100644
--- a/icu4c/source/i18n/messageformat2_errors.cpp
+++ b/icu4c/source/i18n/messageformat2_errors.cpp
@@ -189,10 +189,12 @@ namespace message2 {
void StaticErrors::addError(StaticError&& e, UErrorCode& status) {
CHECK_ERROR(status);
+ StaticErrorType type = e.type;
+
void* errorP = static_cast<void*>(create<StaticError>(std::move(e), status));
U_ASSERT(syntaxAndDataModelErrors.isValid());
- switch (e.type) {
+ switch (type) {
case StaticErrorType::SyntaxError: {
syntaxError = true;
break;
@@ -229,10 +231,12 @@ namespace message2 {
void DynamicErrors::addError(DynamicError&& e, UErrorCode& status) {
CHECK_ERROR(status);
+ DynamicErrorType type = e.type;
+
void* errorP = static_cast<void*>(create<DynamicError>(std::move(e), status));
U_ASSERT(resolutionAndFormattingErrors.isValid());
- switch (e.type) {
+ switch (type) {
case DynamicErrorType::UnresolvedVariable: {
unresolvedVariableError = true;
resolutionAndFormattingErrors->adoptElement(errorP, status);