[clang] [PAC] Re-sign a pointer to a noexcept member function when it is converted to a pointer to a member function without noexcept (PR #109056)
John McCall via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 18 15:08:03 PDT 2024
================
@@ -2419,8 +2419,13 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
return Visit(const_cast<Expr*>(E));
case CK_NoOp: {
- return CE->changesVolatileQualification() ? EmitLoadOfLValue(CE)
- : Visit(const_cast<Expr *>(E));
+ if (CE->changesVolatileQualification())
+ return EmitLoadOfLValue(CE);
+ auto V = Visit(const_cast<Expr *>(E));
+ if (CGF.CGM.getCodeGenOpts().PointerAuth.CXXMemberFunctionPointers &&
+ CE->getType()->isMemberFunctionPointerType())
+ V = CGF.CGM.getCXXABI().EmitMemberPointerConversion(CGF, CE, V);
+ return V;
----------------
rjmccall wrote:
Okay, but that's coincidental, right? The language doesn't semantically guarantee that that conversion is a no-op, it just happens to be under normal conditions, even with function pointer type diversity enabled.
What cast kind do we use if you cast a function pointer to a completely different type?
https://github.com/llvm/llvm-project/pull/109056
More information about the cfe-commits
mailing list