Skip to content

Commit 97068d5

Browse files
Merge pull request #1450 from jchadwick-buf:avoid-nested-status-macros
PiperOrigin-RevId: 754168819
2 parents e30f556 + 33e6be0 commit 97068d5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

common/values/struct_value_builder.cc

+8-2
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,10 @@ class MessageValueBuilderImpl {
930930
reflection_->ClearField(message_, field);
931931
const auto* map_value_field = field->message_type()->map_value();
932932
absl::optional<ErrorValue> error_value;
933-
CEL_RETURN_IF_ERROR(map_value->ForEach(
933+
// Don't replace this pattern with a status macro; nested macro invocations
934+
// have the same __LINE__ on MSVC, causing CEL_ASSIGN_OR_RETURN invocations
935+
// to conflict with each-other.
936+
auto status = map_value->ForEach(
934937
[this, field, key_converter, map_value_field, value_converter,
935938
&error_value](const Value& entry_key,
936939
const Value& entry_value) -> absl::StatusOr<bool> {
@@ -955,7 +958,10 @@ class MessageValueBuilderImpl {
955958
}
956959
return true;
957960
},
958-
descriptor_pool_, message_factory_, arena_));
961+
descriptor_pool_, message_factory_, arena_);
962+
if (!status.ok()) {
963+
return status;
964+
}
959965
return error_value;
960966
}
961967

0 commit comments

Comments
 (0)