[clang] [Clang][Sema] Reject array prvalue operands (PR #140702)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Wed May 21 04:46:26 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 better than "array prvalue" but if you're coming from a C background, that's not going to look like a temporary array to you, either.
What kind of diagnostic would we get for:
```
#define X ({(int[10]){};})
void func() {
(void)(X + 0);
}
```
IIRC there's no rvalue conversion on the statement expression result so I think that ends up being a prvalue of array type (not a decayed pointer) plus an integer, so the type information would actually be helpful.
https://github.com/llvm/llvm-project/pull/140702
More information about the cfe-commits
mailing list