mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2025-01-11 17:10:06 +00:00
Avoid infinite recursion in comparison operators on SmallVector (#4681)
C++20 automatically adds reversed versions of operator overloads for consideration; in this particular instance this results in infinite recursion, which has now been pointed out elsewhere as a known issue when migrating to C++20. Here we just disable one of the overloads in C++20 mode and let the auto-reversing take care of it for us.
This commit is contained in:
parent
58d8b4e29c
commit
e8439c1c9d
@ -175,9 +175,12 @@ class SmallVector {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Avoid infinite recursion from rewritten operators in C++20
|
||||||
|
#if __cplusplus <= 201703L
|
||||||
friend bool operator==(const std::vector<T>& lhs, const SmallVector& rhs) {
|
friend bool operator==(const std::vector<T>& lhs, const SmallVector& rhs) {
|
||||||
return rhs == lhs;
|
return rhs == lhs;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
friend bool operator!=(const SmallVector& lhs, const std::vector<T>& rhs) {
|
friend bool operator!=(const SmallVector& lhs, const std::vector<T>& rhs) {
|
||||||
return !(lhs == rhs);
|
return !(lhs == rhs);
|
||||||
|
Loading…
Reference in New Issue
Block a user