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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed May 21 04:03:23 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">;
----------------
AaronBallman wrote:

It's unfortunate to mention "prvalue" at all because that's language lawyer wording (no offense to @languagelawyer, of course!) which users aren't going to generally be aware of. I think we can kind of get away with `lvalue` and `rvalue` due to those being terms of art for so long, but the C++ taxonomy terms are much more recent and nuanced.

I think `test.cxx:5:16: error: invalid operands to binary expression ('int[3]' and 'double')` is more clearly telling the user what's wrong with their code.

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


More information about the cfe-commits mailing list