[clang] [CIR] Lower C++23 static call/subscript operators correctly (PR #197068)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Mon May 11 16:54:15 PDT 2026


================
@@ -2252,7 +2252,26 @@ RValue CIRGenFunction::emitCall(clang::QualType calleeTy,
   CallArgList args;
   assert(!cir::MissingFeatures::opCallArgEvaluationOrder());
 
-  emitCallArgs(args, dyn_cast<FunctionProtoType>(fnType), e->arguments(),
+  // C++23 static-member operators (`static operator()` /
+  // `static operator[]`) produce a CXXOperatorCallExpr whose first argument
+  // is the object expression even though the operator is static.  Emit the
+  // object for its side effects and drop it before walking the parameter
+  // arguments.
+  bool staticOperator = false;
----------------
erichkeane wrote:

This bool isn't used anywhere else... why not just do the stuff on line 2270/2271 inside the conditional on 2265 instead?

https://github.com/llvm/llvm-project/pull/197068


More information about the cfe-commits mailing list