<div>@@ -79,7 +117,7 @@ static Expr *IsStringInit(Expr *init, QualType declType, ASTContext &Context) {</div><div>   const ArrayType *arrayType = Context.getAsArrayType(declType);</div><div>   if (!arrayType) return 0;</div>
<div> </div><div>-  return IsStringInit(init, arrayType, Context);</div><div>+  return IsStringInit(init, arrayType, Context) == SIF_None ? init : 0;</div><div><br></div><div>Looks like the one and only caller of this doesn't actually want the expression; maybe just return the SIF value here too?</div>
<div><br></div><div><br></div><div><div>@@ -4307,9 +4363,10 @@ InitializationSequence::InitializationSequence(Sema &S,</div><div>       TryListInitialization(S, Entity, Kind, cast<InitListExpr>(Initializer),</div>
<div>                             *this);</div><div>       AddParenthesizedArrayInitStep(DestType);</div><div>-    } else if (DestAT->getElementType()->isAnyCharacterType())</div><div>+    } else if (DestAT->getElementType()->isAnyCharacterType() &&</div>
<div>+               !isa<StringLiteral>(Initializer->IgnoreParens())) {</div></div><div><div>       SetFailed(FK_ArrayNeedsInitListOrStringLiteral);</div></div><div><br></div><div>I don't think this is right -- the diagnostic should depend on whether the element type could be initialized by a string literal, and not on whether the initializer actually was a string literal. That is, in MS C mode,</div>
<div><br></div><div>  __wchar_t str[] = xxxx;</div><div><br></div><div>should not suggest initializing with a string literal, whether xxxx is a string literal or not.</div><div><br></div><div>Otherwise, looks great, thanks.</div>
<br><div class="gmail_quote">On Tue, May 14, 2013 at 9:48 AM, Hans Wennborg <span dir="ltr"><<a href="mailto:hans@chromium.org" target="_blank">hans@chromium.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Tue, May 14, 2013 at 4:12 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>
> On May 13, 2013 9:59 AM, "Hans Wennborg" <<a href="mailto:hans@chromium.org">hans@chromium.org</a>> wrote:<br>
</div><div class="im">>>   /tmp/a.c:3:9: error: initializing wide char array with non-wide string<br>
>> literal<br>
>>   wchar_t s[] = "Hi";<br>
><br>
> Worth it/possible/convenient to go one step further and provide a fixit to<br>
> insert the 'L' and appropriately recover? I suppose that's probably<br>
> orthogonal to your patch, though.<br>
<br>
</div>I can look into it, but as you say, probably orthogonal to this patch.<br>
<div class="HOEnZb"><div class="h5"><br>
Thanks,<br>
Hans<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" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</div></div></blockquote></div><br>