[clang] [Clang][Sema] Reject array prvalue operands (PR #140702)

via cfe-commits cfe-commits at lists.llvm.org
Wed May 21 06:30:31 PDT 2025


================
@@ -7639,6 +7639,8 @@ def warn_param_mismatched_alignment : Warning<
 
 def err_objc_object_assignment : Error<
   "cannot assign to class object (%0 invalid)">;
+def err_typecheck_array_prvalue_operand : Error<
+  "array prvalue is not permitted">;
----------------
cor3ntin wrote:

I agree with @AaronBallman and @Sirraide that using `err_typecheck_invalid_operands` is the better approach here.
The "prvalue" bit is only relevant as far as array decay is concerned (eg : array-to-pointer does not apply). 
But ultimately, `int[]` + `int`  is what we should diagnose, not how we got here.

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


More information about the cfe-commits mailing list