<p dir="ltr"><br>
On May 13, 2013 9:59 AM, "Hans Wennborg" <<a href="mailto:hans@chromium.org">hans@chromium.org</a>> wrote:<br>
><br>
> Hi all,<br>
><br>
> The attached patch fixes Clang's diagnostics concerning string<br>
> initialization. Where it would previously say:<br>
><br>
>   /tmp/a.c:3:9: error: array initializer must be an initializer list<br>
>   wchar_t s[] = "Hi";<br>
>           ^<br>
>   /tmp/a.c:4:6: error: array initializer must be an initializer list<br>
> or string literal<br>
>   char t[] = L"Hi";<br>
>        ^<br>
><br>
> It will now say<br>
><br>
>   /tmp/a.c:3:9: error: initializing wide char array with non-wide string literal<br>
>   wchar_t s[] = "Hi";</p>
<p dir="ltr">Worth it/possible/convenient to go one step further and provide a fixit to insert the 'L' and appropriately recover? I suppose that's probably orthogonal to your patch, though.</p>
<p dir="ltr">>           ^<br>
>   /tmp/a.c:4:6: error: initializing char array with wide string literal<br>
>   char t[] = L"Hi";<br>
>        ^<br>
><br>
> As a bonus, it also fixes the fact that Clang would previously reject<br>
> this valid C11 code:<br>
><br>
>   char16_t s[] = u"hi";<br>
>   char32_t t[] = U"hi";1<br>
><br>
> because it would only recognize the built-in types for char16_t and<br>
> char32_t, which do not exist in C.<br>
><br>
> Please take a look.<br>
><br>
> Thanks,<br>
> Hans<br>
><br>
> _______________________________________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
><br>
</p>