[clang] [Sema] Decay functions/array to pointers in `IncompatiblePointerDiscardsQualifiers` and `IncompatibleOBTKinds` cases (PR #187038)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 1 06:41:18 PDT 2026
================
@@ -17705,6 +17706,12 @@ bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy,
case AssignConvertType::CompatibleOBTDiscards:
return false;
case AssignConvertType::IncompatibleOBTKinds: {
+ assert(!SrcType->isFunctionType() &&
+ "Unexpected function type found in IncompatibleOBTKinds assignment");
+ if (SrcType->canDecayToPointerType()) {
+ SrcType = Context.getDecayedType(SrcType);
+ }
----------------
AaronBallman wrote:
```suggestion
if (SrcType->canDecayToPointerType())
SrcType = Context.getDecayedType(SrcType);
```
https://github.com/llvm/llvm-project/pull/187038
More information about the cfe-commits
mailing list