[clang] Improve diagnostic for "initializer-string for char array is too long"
authorEvan Smal <evan.smal@hotmail.com>
Thu, 19 Jan 2023 12:11:07 +0000 (13:11 +0100)
committerTimm Bäder <tbaeder@redhat.com>
Thu, 19 Jan 2023 12:13:08 +0000 (13:13 +0100)
commit1499cce2646cbf4dd78f8534a4e71bd856b10994
treecca48d3460bf180aa376af3ca5741bcf3a6eb371
parent655c88ca3631c0f64fa187f0fe9ad0dae7273026
[clang] Improve diagnostic for "initializer-string for char array is too long"

This patch improves the diagnostic message "initializer-string for
char array is too long" by specifying an expected array length and by
indicating that the initializer string implicitly includes the
null terminator.

Fixes #58829

Differential Revision: https://reviews.llvm.org/D141283
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/SemaInit.cpp
clang/test/CXX/dcl.decl/dcl.init/dcl.init.string/p2.cpp