Open AaronBallman opened 3 months ago
I'll gladly work on this issue, feel free to assign to me.
I'll gladly work on this issue, feel free to assign to me.
Thank you! There may be several diagnostics that could use the same kind of updating. Bonus points if we can find a way to make this automated by the diagnostics engine when printing type differences so that folks writing diagnostics don't have to think about VLAs as a special wording case.
Consider an example like the following, compiled in C++:
https://godbolt.org/z/oET6jjjzj
This emits a very confusing diagnostic:
error: incompatible pointer types assigning to 'int (*)[n]' from 'int (*)[n]'
and users are understandably confused by it: https://discourse.llvm.org/t/clang-pointer-assignment-error-message/80265It would be better to identify when both types are VLAs with the same bounds, and instead of repeating identical types, issue a diagnostic specific to VLAs. e.g.,
error: incompatible assignment of pointers of variable-length array type 'int (*)[n]'; consider using a typedef to use the same variable-length array type for both operands
or something along those lines.