[all-commits] [llvm/llvm-project] cf9374: [Modularize] Make `Location::operator bool` explicit
Ilya Biryukov via All-commits
all-commits at lists.llvm.org
Tue Jul 1 07:41:07 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: cf9374933d2eacf91dae95e69082cba806f27c42
https://github.com/llvm/llvm-project/commit/cf9374933d2eacf91dae95e69082cba806f27c42
Author: Ilya Biryukov <ibiryukov at google.com>
Date: 2025-07-01 (Tue, 01 Jul 2025)
Changed paths:
M clang-tools-extra/modularize/Modularize.cpp
Log Message:
-----------
[Modularize] Make `Location::operator bool` explicit
This unbreaks C++20 buildbot that was broken since
402baea0a9ff7894565449e41f700c4e6a3f99cb.
With implicit conversion in C++20 compilation mode the spaceship
will unintentionally be based on `operator bool`:
```cpp
auto foo(Location L, Location R) {
return L <=> R;
// Equivalent to the following line due to implicit conversions.
// return L.operator bool() <=> R.operator bool();
}
```
The spaceship operator is rarely used explicitly, but its implicit uses
in the STL may cause surprising results, as exposed by the use of `std::tie`
in 402baea0a9ff7894565449e41f700c4e6a3f99cb, which ended up changing the
comparisons results unintentionally.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list