<div class="gmail_quote">On Thu, Oct 20, 2011 at 4:39 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</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 Fri, October 21, 2011 00:08, Richard Trieu wrote:<br>
> On Thu, Oct 20, 2011 at 2:53 PM, Richard Smith <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>>wrote:<br>
</div><div class="im">>> On Thu, October 20, 2011 22:06, Richard Trieu wrote:<br>
>>> Update Clang to not complain when printing IntegerLiterals with type<br>
>>> short, unsigned short, __int128_t, or __uint128_t.  This will fix PR11179.<br>
>>><br>
>>> PR:<br>
>>> <a href="http://llvm.org/bugs/show_bug.cgi?id=11179" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=11179</a><br>
>>><br>
>>><br>
>>> Patch also located at:<br>
>>> <a href="http://codereview.appspot.com/5309045/" target="_blank">http://codereview.appspot.com/5309045/</a><br>
>><br>
>> For __int128_t and __uint128_t, the approach looks fine (though the printed<br>
>>  value should include the "i128" or "Ui128" suffix).<br>
><br>
> Are those the correct suffixes?  Clang and gcc doesn't recognize them as<br>
> valid integer constant suffixes.<br>
<br>
</div>You need -fms-extensions to enable it. Without that extension, there's no way<br>
to write an __int128_t literal.<br>
<div class="im"><br></div></blockquote><div>Should Clang be printing suffixes that are accepted only with certain flags?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">
>> For short and unsigned short, it seems to me that this is a bug in<br>
>> Sema::BuildExpressionFromIntegralTemplateArgument: we shouldn't be creating<br>
>> IntegerLiteral AST nodes with those types (or with negative values, for<br>
>> that matter).<br>
><br>
> Why can't an integer literal be short or negative?<br>
<br>
</div>That's just how the C language family works: there's no way of writing an<br>
integer literal which is negative or short.<br>
<span class="HOEnZb"><font color="#888888"><br></font></span></blockquote><div>While there is no way to write negative or short integers, Clang uses integer literal to store information for other purposes.  For instance, instantiated templates will store template arguments as an integer literal.  If the template parameter is a short and the argument used is negative, then an integer literal with a negative value and short type will be created.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><span class="HOEnZb"><font color="#888888">
Richard<br>
<br>
</font></span></blockquote></div><br>