Skip to content

Commit

Permalink
mojo: Fix potential name collision in unions C++ bindings
Browse files Browse the repository at this point in the history
Changes parameter {{field.name}} to "value" to avoid
conflict with internally declared variable "result". This prevents
build failure when {{field.name}} is "result".

Bug: None
Change-Id: I2a462eb07ead8adaa4d79ce4cea7c0cfb81db441
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4987067
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Imran Ziad <imranziad@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1217447}
  • Loading branch information
Imran Ziad authored and Chromium LUCI CQ committed Oct 31, 2023
1 parent 3f229d3 commit 6cac8db
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class {{export_attribute}} {{union.name}} {
// Construct an instance holding |{{field.name}}|.
static {{union.name}}Ptr
New{{field.name|under_to_camel}}(
{{field.kind|cpp_wrapper_param_type_new}} {{field.name}}) {
{{field.kind|cpp_wrapper_param_type_new}} value) {
auto result = {{union.name}}Ptr(absl::in_place);
result->set_{{field.name}}(std::move({{field.name}}));
result->set_{{field.name}}(std::move(value));
return result;
}
{%- endfor %}
Expand Down

0 comments on commit 6cac8db

Please sign in to comment.