<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div class="h5">> /tmp/webcompile/_934_0.cc:8:3: error: switch condition type 'foo' requires<br>

> explicit conversion to 'int'<br>
>   switch(foo())<br>
>   ^<br>
>          stati)_cast<int>(<br>
><br>
> Which shows two problems:<br>
><br>
> 1) Multiple carets points don't seem to be shown, only the first one (in<br>
> this case, the location of the diagnostic, not the location of either of the<br>
> suggested FixIts)<br>
> 2) If two FixIts overlap, in this case causing the second (")") to be<br>
> embedded inside the first (replacing the "c" in "static")<br>
><br>
> Are these known issues? Has there been any thought/discussion on how they<br>
> should be fixed? (I imagine fixing (1) shouldn't be terribly hard, but I<br>
> haven't looked. Though (2) will presumably require slightly more work to<br>
> shift the fixits across and make it clear which piece is to be inserted<br>
> where)<br>
><br>
> - David<br>
<br>
</div></div>Hi,<br>
Yes I also noticed this problem last week.<br>
I filled a bugzilla:<br>
<a href="http://llvm.org/bugs/show_bug.cgi?id=10696" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=10696</a><br>
</blockquote></div><br><div>Thanks - that's (2) at least. Following on from the bug discussion I think it'd be a pity to drop the fixit entirely - though better than having it broken like that, sure.<br><br>Could we toss around some alternative syntax options & see what people think?<br>
<br><span class="Apple-style-span" style="font-family: Verdana, sans-serif; background-color: rgb(255, 255, 255); "><pre class="bz_comment_text" style="font-size: medium; font-family: monospace; white-space: pre-wrap; width: 50em; ">
A var = { b};
          ^
          s)atic_cast<unsigned int>(</pre><pre class="bz_comment_text" style="font-size: medium; font-family: monospace; white-space: pre-wrap; width: 50em; ">One option would be to just suggest the whole replacement (not by changing the FixIt emitted - that should remain the same so it's fully descriptive for other tools. But just to change the way its rendered):</pre>
</span><span class="Apple-style-span" style="font-family: Verdana, sans-serif; background-color: rgb(255, 255, 255); "><pre class="bz_comment_text" style="font-size: medium; font-family: monospace; white-space: pre-wrap; width: 50em; ">
A var = { b};
          ^
          static_cast<unsigned int>(b)</pre><pre class="bz_comment_text" style="font-size: medium; font-family: monospace; white-space: pre-wrap; width: 50em; ">or somehow attach the start & end separately:</pre>
</span><span class="Apple-style-span" style="font-family: Verdana, sans-serif; background-color: rgb(255, 255, 255); "><pre class="bz_comment_text" style="font-size: medium; font-family: monospace; white-space: pre-wrap; width: 50em; ">
A var = { b};
          ^^-------------------------\
          static_cast<unsigned int>( )</pre><pre class="bz_comment_text" style="font-size: medium; font-family: monospace; white-space: pre-wrap; width: 50em; ">Though that doesn't really scale up to more than one overlap. (which might be sufficient to cover more/most cases like this)</pre>
</span><span class="Apple-style-span" style="font-family: Verdana, sans-serif; background-color: rgb(255, 255, 255); "><pre class="bz_comment_text" style="font-size: medium; font-family: monospace; white-space: pre-wrap; width: 50em; ">
A simple separated list (could benefit from color highlighting, but we wouldn't want to depend on that)</pre></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif; background-color: rgb(255, 255, 255); "><pre class="bz_comment_text" style="font-size: medium; font-family: monospace; white-space: pre-wrap; width: 50em; ">
A var = { b};
          ^^
          static_cast<unsigned int>( )</pre><pre class="bz_comment_text" style="font-size: medium; font-family: monospace; white-space: pre-wrap; width: 50em; ">Is there any good separator we could use in this list that wouldn't get confused with the actual replacement text?

(could we even render fixits completely differently in the presence of terminal colors? </pre></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif; background-color: rgb(255, 255, 255); "><pre class="bz_comment_text" style="font-size: medium; font-family: monospace; white-space: pre-wrap; width: 50em; ">
A var = { <b><font class="Apple-style-span" color="#009900">static_cast<unsigned int>(</font></b>b<b><font class="Apple-style-span" color="#33cc00">)</font></b>};</pre><pre class="bz_comment_text" style="font-size: medium; font-family: monospace; white-space: pre-wrap; width: 50em; ">
<span class="Apple-style-span">Though I suppose this doesn't account for replacements (where we'd want to show the old & the new text) in which case we could pad the original text:
</span></pre></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif; background-color: rgb(255, 255, 255); "><pre class="bz_comment_text" style="font-size: medium; font-family: monospace; white-space: pre-wrap; width: 50em; ">
A var = { <font class="Apple-style-span" style="font-weight: bold; " color="#cc0000">foo   </font>(b)};
          <font class="Apple-style-span" color="#009900">foobar
</font></pre><pre class="bz_comment_text" style="font-size: medium; font-family: monospace; white-space: pre-wrap; width: 50em; ">)</pre><pre class="bz_comment_text" style="font-size: medium; font-family: monospace; white-space: pre-wrap; width: 50em; ">
<font class="Apple-style-span" color="#009900">
</font></pre></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif; background-color: rgb(255, 255, 255); "><pre class="bz_comment_text" style="font-size: medium; font-family: monospace; white-space: pre-wrap; width: 50em; ">
<span class="Apple-style-span">

</span></pre></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif; background-color: rgb(255, 255, 255); "><pre class="bz_comment_text" style="font-size: medium; font-family: monospace; white-space: pre-wrap; width: 50em; ">
</pre></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif; background-color: rgb(255, 255, 255); "><pre class="bz_comment_text" style="font-size: medium; font-family: monospace; white-space: pre-wrap; width: 50em; ">
</pre></span><br><br></div>