aboutsummaryrefslogtreecommitdiff
path: root/libc/src/stdio
diff options
context:
space:
mode:
authorSamira Bazuzi <bazuzi@users.noreply.github.com>2023-10-11 23:59:13 -0400
committerGitHub <noreply@github.com>2023-10-11 23:59:13 -0400
commitb5c2fa14ea771c3333435b18afad1d5e09f69fbe (patch)
tree824b5508b983b9f4c4eafda5ffc30daa2697d72e /libc/src/stdio
parent1379a7286e156af2d96cb0f3d8aa8e5c7f56bccd (diff)
downloadllvm-b5c2fa14ea771c3333435b18afad1d5e09f69fbe.zip
llvm-b5c2fa14ea771c3333435b18afad1d5e09f69fbe.tar.gz
llvm-b5c2fa14ea771c3333435b18afad1d5e09f69fbe.tar.bz2
[libc] Mark operator== const to avoid ambiguity in C++20. (#68805)
C++20 will automatically generate an operator== with reversed operand order, which is ambiguous with the written operator== when one argument is marked const and the other isn't. This operator currently triggers -Wambiguous-reversed-operator at usage site libc/test/UnitTest/PrintfMatcher.cpp:28.
Diffstat (limited to 'libc/src/stdio')
-rw-r--r--libc/src/stdio/printf_core/core_structs.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/libc/src/stdio/printf_core/core_structs.h b/libc/src/stdio/printf_core/core_structs.h
index e96bc4d..88a1370 100644
--- a/libc/src/stdio/printf_core/core_structs.h
+++ b/libc/src/stdio/printf_core/core_structs.h
@@ -53,7 +53,7 @@ struct FormatSection {
// This operator is only used for testing and should be automatically
// optimized out for release builds.
- bool operator==(const FormatSection &other) {
+ bool operator==(const FormatSection &other) const {
if (has_conv != other.has_conv)
return false;