[clang] [clang][Sema] decay functions to pointers for qualifier discarding and overflow behavior (PR #183616)

via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 12 01:21:16 PDT 2026


================
@@ -17528,8 +17528,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())
+      SrcType = Context.getDecayedType(SrcType);
----------------
NeKon69 wrote:

We can produce a test case for this (see first func declaration in the test file), I wasn't able to produce a test case for `IncompatiblePointerDiscardsOverflowBehavior` with function types

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


More information about the cfe-commits mailing list