[clang] fba88ad - [Sema] Always perform ADL when searching for transormed operators in C++20
Ilya Biryukov via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 12 07:14:49 PDT 2022
Author: Ilya Biryukov
Date: 2022-08-12T16:07:02+02:00
New Revision: fba88adc8961fc8b8d7dece7bfecbfc31c652aff
URL: https://github.com/llvm/llvm-project/commit/fba88adc8961fc8b8d7dece7bfecbfc31c652aff
DIFF: https://github.com/llvm/llvm-project/commit/fba88adc8961fc8b8d7dece7bfecbfc31c652aff.diff
LOG: [Sema] Always perform ADL when searching for transormed operators in C++20
This fixes compilation errors in the following code with
latest libc++ and libstdc++:
```cpp
int main() {
std::tuple<std::string> s;
std::tuple<std::string_view> sv;
s < sv;
}
```
See https://gcc.godbolt.org/z/vGvEhxWvh for the error.
This used to happen because repeated template instantiations during
C++20 constraint satisfaction will cause a call to `RebuildCXXRewrittenBinaryOperator`
with `PerformADL` set to false, see https://github.com/llvm/llvm-project/blob/59351fe340f20a605bae53260ed30a8e0fd95cb6/clang/lib/Sema/TreeTransform.h#L2737
Committing urgently to unbreak breakages we see in our configurations.
The change seems relatively safe and the right thing to do.
However, I will follow-up with tests and investigation on whether we
need to do this extra semantic checking in the first place next week.
Added:
Modified:
clang/lib/Sema/SemaOverload.cpp
Removed:
################################################################################
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index c88413b3e5de..91e308d0d0fe 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -13930,7 +13930,7 @@ ExprResult Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
R = CreateOverloadedBinOp(
OpLoc, Opc, Fns, IsReversed ? ZeroLiteral : R.get(),
- IsReversed ? R.get() : ZeroLiteral, PerformADL,
+ IsReversed ? R.get() : ZeroLiteral, /*PerformADL=*/true,
/*AllowRewrittenCandidates=*/false);
popCodeSynthesisContext();
More information about the cfe-commits
mailing list