Concatenation of wide and narrow string literals has not always been supported in C or C++, and even when supported, the meaning may be unclear to
the reader. Furthermore, concatenation of string literals with different encodings was only conditionally supported prior to C++23, and is now
explicitly ill-formed as of C++23.
Therefore, only string literals with the same prefix should be concatenated together.
Noncompliant code example
wchar_t n_array[] = "Hello" L"World"; // Noncompliant
wchar_t w_array[] = L"Hello" "World"; // Noncompliant
auto u8_array = "Hello" u8"World"; // Noncompliant
auto u_array = u"Hello" "World"; // Noncompliant
// Mixed encoding prefixes (ill-formed as of C++23)
auto mixed1 = L"Hello" u8"World"; // Noncompliant
auto mixed2 = u"Hello" U"World"; // Noncompliant
auto mixed3 = u8"Hello" u"World"; // Noncompliant
Compliant solution
char n_array[] = "Hello" "World"; // Compliant
wchar_t w_array[] = L"Hello" L"World"; // Compliant
auto u8_array = u8"Hello" u8"World"; // Compliant
auto u_array = u"Hello" u"World"; // Compliant