commit | b0d26ea54748bf6dc869d60d1ddfc97bb045966e | [log] [tgz] |
---|---|---|
author | David Benjamin <davidben@chromium.org> | Mon Mar 11 12:33:16 2024 |
committer | Chromium LUCI CQ <chromium-scoped@luci-project-accounts.iam.gserviceaccount.com> | Mon Mar 11 12:33:16 2024 |
tree | 39c817bbca7a5d142e0fbd1c321b1778ca8162ac | |
parent | 075afa69f190f0de30e89250f5a236e2aa37c5b0 [diff] |
Fix some more incompatibilities with std::variant from narrowing std::variant does not allow narrowing conversions. absl::variant didn't quite get this right, which means narrowing conversions sometimes sneak in. The main non-obvious consequence is that variant<size_t, ...> cannot be constructed from literals like 0 or 2. Such literals have type int, and an int may be negative. These ints will not be negative, but the language has lost this information by the time it calls the std::variant constructor. Writing 0u or 2u works because those have type unsigned, which can convert to size_t without narrowing. In C++23, we'll have 0uz and 2uz which even have type size_t, but we're not there yet and no supported platform has unsigned larger than size_t. Conversely, a variant<int, ...> cannot be constructed from a size_t because size_t may not fit in int. That need a checked_cast. There was also one instance of Persistent<T>, where I used an in_place_type. Bug: 40242126 Change-Id: I0b6c16f120553284545451df5aaf5d550824b5d2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5352774 Reviewed-by: Thomas Nguyen <tungnh@chromium.org> Reviewed-by: Aya Elsayed <ayaelattar@chromium.org> Reviewed-by: Steinar H Gunderson <sesse@chromium.org> Commit-Queue: Aya Elsayed <ayaelattar@chromium.org> Auto-Submit: David Benjamin <davidben@chromium.org> Cr-Commit-Position: refs/heads/main@{#1270890}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
To check out the source code locally, don't use git clone
! Instead, follow the instructions on how to get the code.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure.
For historical reasons, there are some small top level directories. Now the guidance is that new top level directories are for product (e.g. Chrome, Android WebView, Ash). Even if these products have multiple executables, the code should be in subdirectories of the product.
If you found a bug, please file it at https://crbug.com/new.