[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
Mon Mar 30 07:56:48 PDT 2026


================
@@ -17555,8 +17536,9 @@ bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy,
     }
     break;
   case AssignConvertType::IncompatiblePointerDiscardsQualifiers: {
-    // Perform array-to-pointer decay if necessary.
-    if (SrcType->isArrayType()) SrcType = Context.getArrayDecayedType(SrcType);
+    // Perform decay if necessary.
+    if (SrcType->isArrayType() || SrcType->isFunctionType())
----------------
AaronBallman wrote:

```suggestion
    if (SrcType->canDecayToPointerType())
```

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


More information about the cfe-commits mailing list