[libcxx-commits] [libunwind] [flang] [libcxx] [libcxxabi] [lldb] [llvm] [clang] [compiler-rt] [lld] [openmp] [libc] [mlir] [clang-tools-extra] [clang] static operators should evaluate object argument (PR #68485)
Tianlan Zhou via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jan 30 19:13:22 PST 2024
================
@@ -15097,15 +15102,9 @@ ExprResult Sema::CreateOverloadedArraySubscriptExpr(SourceLocation LLoc,
ExprValueKind VK = Expr::getValueKindForType(ResultTy);
ResultTy = ResultTy.getNonLValueExprType(Context);
- CallExpr *TheCall;
- if (Method->isInstance())
- TheCall = CXXOperatorCallExpr::Create(
- Context, OO_Subscript, FnExpr.get(), MethodArgs, ResultTy, VK,
- RLoc, CurFPFeatureOverrides());
- else
- TheCall =
- CallExpr::Create(Context, FnExpr.get(), MethodArgs, ResultTy, VK,
- RLoc, CurFPFeatureOverrides());
+ CallExpr *TheCall = CXXOperatorCallExpr::Create(
----------------
SuperSodaSea wrote:
In short, for the following code
```cpp
// struct Foo { static int operator(int a, int b); };
// Foo foo;
foo(1, 2);
```
, the AST is changed from
```
CallExpr
|- operator()
|- a
\- b
```
to
```
CXXOperatorCallExpr
|- operator()
|- foo
|- a
\- b
```
And other situations are not affected.
https://github.com/llvm/llvm-project/pull/68485
More information about the libcxx-commits
mailing list