commit | 4bbdd7f83187901fbf6bc2eb23b48d8749ef8dc9 | [log] [tgz] |
---|---|---|
author | Yifei Teng <yifeit@google.com> | Thu Feb 09 20:07:32 2023 +0000 |
committer | CQ Bot <fuchsia-internal-scoped@luci-project-accounts.iam.gserviceaccount.com> | Thu Feb 09 20:07:32 2023 +0000 |
tree | 2ff1511918b0846e138de04760b6ff87ca108c8b | |
parent | 8dce40608114e62fefa678c95f77a8d8b0b004ba [diff] |
[fidl][cpp] Don't use ToUnderlying when converting enums When the new C++ bindings is used in Chromium we found that HLCPP/natural enum conversion breaks when an enum-less library is included in front of the library of interest. The reason is that we have multiple overloads of `fidl::ToUnderlying`. There is one overload for HLCPP strict enums, and separate overloads defined for natural strict & flexble enums. Due to [1], a templated class that uses ToUnderlying can only use ToUnderlying overloads that were already included before it. Thus sometimes the natural strict & flexible overloads aren't visible to the compiler. In user code, people can call `fidl::ToUnderlying` and all the necessary overloads are already included. However, inside FIDL library code such as `lib/fidl/cpp/hlcpp_conversion.h`, not all `fidl::ToUnderlying` are defined at the point when that header is included. The most straightforward solution is to not use `fidl::ToUnderlying` in FIDL runtime libraries. [1]: https://en.cppreference.com/w/cpp/language/dependent_name Change-Id: I8c1058cb4b1eae5e5d3b9f38a769c19aad0c855a Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/800049 Reviewed-by: Ian McKellar <ianloic@google.com> Commit-Queue: Yifei Teng <yifeit@google.com> API-Review: Ian McKellar <ianloic@google.com>
Fuchsia is an open source, general purpose operating system supporting modern 64-bit Intel and ARM processors.
We expect everyone interacting with our project to respect our code of conduct.
Read more about Fuchsia's principles.
See Getting Started.
See fuchsia.dev.