[clang] [clang] Fix handling of explicit-`this` functions as template arguments (PR #133748)

via cfe-commits cfe-commits at lists.llvm.org
Fri May 2 03:09:27 PDT 2025


================
@@ -7558,6 +7558,18 @@ ExprResult Sema::BuildExpressionFromDeclTemplateArgument(
   } else {
     assert(ParamType->isReferenceType() &&
            "unexpected type for decl template argument");
+
+    if (auto *Method = dyn_cast<CXXMethodDecl>(VD);
+        Method && Method->isExplicitObjectMemberFunction()) {
+      // If the argument is an explicit object member function,
+      // RefExpr is currently a prvalue. Make it an lvalue.
+      RefExpr = ImplicitCastExpr::Create(
+          Context, RefExpr.get()->getType(), CK_NoOp, RefExpr.get(),
----------------
cor3ntin wrote:

We use UO_Deref in other places

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


More information about the cfe-commits mailing list