================ @@ -5813,6 +5813,27 @@ static TypoCorrection TryTypoCorrectionForCall(Sema &S, Expr *Fn, return TypoCorrection(); } +// [C++26][[expr.unary.op]/p4 +// A pointer to member is only formed when an explicit & +// is used and its operand is a qualified-id not enclosed in parentheses. +static bool isParenthetizedAndQualifiedAddressOfExpr(Expr *Fn) { + if (!isa<ParenExpr>(Fn)) + return false; + + Fn = Fn->IgnoreParens(); + + auto *UO = dyn_cast<UnaryOperator>(Fn); + if (!UO || UO->getOpcode() != clang::UO_AddrOf) + return false; + if (auto *DRE = dyn_cast<DeclRefExpr>(UO->getSubExpr()->IgnoreParens())) { + return DRE->hasQualifier(); + } + if (auto *OVL = dyn_cast<OverloadExpr>(UO->getSubExpr()->IgnoreParens())) { + return OVL->getQualifier(); + } ---------------- AaronBallman wrote:
```suggestion if (auto *DRE = dyn_cast<DeclRefExpr>(UO->getSubExpr()->IgnoreParens())) return DRE->hasQualifier(); if (auto *OVL = dyn_cast<OverloadExpr>(UO->getSubExpr()->IgnoreParens())) return OVL->getQualifier(); ``` additional: is it possible to get a `MemberExpr` instead of a `DeclRefExpr`? (Thinking about accessing a data member by name; looks like a `DeclRefExpr` but is actually a `MemberExpr`.) https://github.com/llvm/llvm-project/pull/93430 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits