================
@@ -1868,6 +1868,28 @@ bool Sema::IsFunctionConversion(QualType FromType, 
QualType ToType,
       FromFn = QT->getAs<FunctionType>();
       Changed = true;
     }
+
+    if (getLangOpts().CPlusPlus) {
+      // For C, when called from checkPointerTypesForAssignment,
+      // we need not to change the type, or else even an innocuous cast
+      // like dropping effects will fail.
----------------
Sirraide wrote:

> Or is this just a matter of the comment not clearly describing the intent of 
> the code?

Mostly the latter; the comment being inside the `if` statement makes it seem 
like it is supposed to describe what we’re doing inside the `if`, which only 
happens in C++ mode; but the actual text of the comment seems to describe that 
we’re *not* doing in C mode. 

I think the intent here was to point out why this is only supposed to happen in 
C++ mode, so I’d move the comment outside the `if` and maybe reword it to where 
that’s a bit clearer, because the way it is right now is a bit confusing, at 
least to me.

https://github.com/llvm/llvm-project/pull/84983
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to