<div class="gmail_quote">On Tue, May 15, 2012 at 3:16 PM, Nico Weber <span dir="ltr"><<a href="mailto:thakis@chromium.org" target="_blank">thakis@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="gmail_quote"><div class="im">On Tue, May 15, 2012 at 2:59 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div>On Tue, May 15, 2012 at 10:43 AM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:<br>
> On Tue, May 15, 2012 at 10:39 AM, Nico Weber <<a href="mailto:thakis@chromium.org" target="_blank">thakis@chromium.org</a>> wrote:<br>
>> Hi David,<br>
>><br>
>> as mentioned on the thread for this warning, with this change clang warns on<br>
><br>
> Ah, right - sorry, I'd forgotten that even the NULL case had some<br>
> problems. I'll see what I can do to tidy this case up sooner rather<br>
> than later. Thanks for the reminder.<br>
<br>
</div>I believe r156861 should help handle this case.</blockquote><div><br></div></div><div>The warnings on lines with `if ( ! YY_CURRENT_BUFFER)` lines are gone, but `if (YY_CURRENT_BUFFER)` still warns:</div><div><br></div>
<div>
<div>hummer:src thakis$  /Users/thakis/src/llvm-svn/Release+Asserts/bin/clang++  --version</div><div>clang version 3.2 (trunk 156862)</div><div>Target: x86_64-apple-darwin10.8.0</div><div>Thread model: posix</div></div><div>

<br></div><div>$ ...</div><div>glsl_lexer.cpp:2778:7: error: implicit conversion of NULL constant to 'bool' [-Werror,-Wnull-conversion]</div><div><div>        if ( YY_CURRENT_BUFFER )</div><div>             ^~~~~~~~~~~~~~~~~</div>

<div>glsl_lexer.cpp:273:29: note: expanded from macro 'YY_CURRENT_BUFFER'</div><div>                          : NULL)</div><div>                            ^</div></div></div></blockquote><div><br></div><div>If this is taking a while to fix, would you mind reverting this in the meantime?</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_quote"><div><div class="h5"><div><br></div><div><br></div><div><br></div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> Thanks again,<br>
<div><div><br>
- David<br>
<br>
>><br>
>> #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \<br>
>>                           ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \<br>
>>                           : NULL)<br>
>><br>
>> // ...<br>
>><br>
>> if ( ! YY_CURRENT_BUFFER ) {<br>
>> // ...<br>
>> }<br>
>><br>
>> with this message:<br>
>><br>
>> ./pp_lex.cpp:784:10: error: implicit conversion of NULL constant to 'bool'<br>
>> [-Werror,-Wnull-conversion]<br>
>>                 if ( ! YY_CURRENT_BUFFER ) {<br>
>>                        ^~~~~~~~~~~~~~~~~<br>
>> ./pp_lex.cpp:295:29: note: expanded from macro 'YY_CURRENT_BUFFER'<br>
>>                           : NULL)<br>
>>                             ^<br>
>><br>
>><br>
>> This looks like valid code to me.<br>
>><br>
>> Nico<br>
>><br>
>> On Tue, May 15, 2012 at 9:56 AM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:<br>
>>><br>
>>> Author: dblaikie<br>
>>> Date: Tue May 15 11:56:36 2012<br>
>>> New Revision: 156826<br>
>>><br>
>>> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=156826&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=156826&view=rev</a><br>
>>> Log:<br>
>>> Improve some of the conversion warnings to fire on conversion to bool.<br>
>>><br>
>>> Moves the bool bail-out down a little in SemaChecking - so now<br>
>>> -Wnull-conversion and -Wliteral-conversion can fire when the target type<br>
>>> is<br>
>>> bool.<br>
>>><br>
>>> Also improve the wording/details in the -Wliteral-conversion warning to<br>
>>> match<br>
>>> the -Wconstant-conversion.<br>
>>><br>
>>> Modified:<br>
>>>    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td<br>
>>>    cfe/trunk/lib/Sema/SemaChecking.cpp<br>
>>>    cfe/trunk/test/Analysis/array-struct-region.c<br>
>>>    cfe/trunk/test/CXX/expr/expr.unary/expr.unary.op/p6.cpp<br>
>>>    cfe/trunk/test/CXX/temp/temp.spec/p5.cpp<br>
>>>    cfe/trunk/test/PCH/exprs.h<br>
>>>    cfe/trunk/test/Sema/array-init.c<br>
>>>    cfe/trunk/test/Sema/knr-def-call.c<br>
>>>    cfe/trunk/test/SemaCXX/bool.cpp<br>
>>>    cfe/trunk/test/SemaCXX/conversion.cpp<br>
>>>    cfe/trunk/test/SemaCXX/expressions.cpp<br>
>>>    cfe/trunk/test/SemaCXX/overload-call.cpp<br>
>>>    cfe/trunk/test/SemaCXX/warn-literal-conversion.cpp<br>
>>>    cfe/trunk/test/SemaTemplate/member-template-access-expr.cpp<br>
>>><br>
>>> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td<br>
>>> URL:<br>
>>> <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=156826&r1=156825&r2=156826&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=156826&r1=156825&r2=156826&view=diff</a><br>


>>><br>
>>> ==============================================================================<br>
>>> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)<br>
>>> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue May 15<br>
>>> 11:56:36 2012<br>
>>> @@ -1781,8 +1781,7 @@<br>
>>>   "implicit truncation from %2 to bitfield changes value from %0 to %1">,<br>
>>>   InGroup<ConstantConversion>;<br>
>>>  def warn_impcast_literal_float_to_integer : Warning<<br>
>>> -  "implicit conversion turns literal floating-point number into integer:<br>
>>> "<br>
>>> -  "%0 to %1">,<br>
>>> +  "implicit conversion from %0 to %1 changes value from %2 to %3">,<br>
>>>   InGroup<LiteralConversion>;<br>
>>>  def warn_impcast_string_literal_to_bool : Warning<<br>
>>>   "implicit conversion turns string literal into bool: %0 to %1">,<br>
>>><br>
>>> Modified: cfe/trunk/lib/Sema/SemaChecking.cpp<br>
>>> URL:<br>
>>> <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=156826&r1=156825&r2=156826&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=156826&r1=156825&r2=156826&view=diff</a><br>


>>><br>
>>> ==============================================================================<br>
>>> --- cfe/trunk/lib/Sema/SemaChecking.cpp (original)<br>
>>> +++ cfe/trunk/lib/Sema/SemaChecking.cpp Tue May 15 11:56:36 2012<br>
>>> @@ -22,6 +22,7 @@<br>
>>>  #include "clang/AST/CharUnits.h"<br>
>>>  #include "clang/AST/DeclCXX.h"<br>
>>>  #include "clang/AST/DeclObjC.h"<br>
>>> +#include "clang/AST/Expr.h"<br>
>>>  #include "clang/AST/ExprCXX.h"<br>
>>>  #include "clang/AST/ExprObjC.h"<br>
>>>  #include "clang/AST/EvaluatedExprVisitor.h"<br>
>>> @@ -4081,8 +4082,17 @@<br>
>>>       == llvm::APFloat::opOK && isExact)<br>
>>>     return;<br>
>>><br>
>>><br>
>>> +  SmallString<16> PrettySourceValue;<br>
>>> +  Value.toString(PrettySourceValue);<br>
>>> +  std::string PrettyTargetValue;<br>
>>> +  if (T->isSpecificBuiltinType(BuiltinType::Bool))<br>
>>> +    PrettyTargetValue = IntegerValue == 0 ? "false" : "true";<br>
>>> +  else<br>
>>> +    PrettyTargetValue = IntegerValue.toString(10);<br>
>>> +<br>
>>>   S.Diag(FL->getExprLoc(), diag::warn_impcast_literal_float_to_integer)<br>
>>> -    << FL->getType() << T << FL->getSourceRange() <<<br>
>>> SourceRange(CContext);<br>
>>> +    << FL->getType() << T.getUnqualifiedType() << PrettySourceValue<br>
>>> +    << PrettyTargetValue << FL->getSourceRange() <<<br>
>>> SourceRange(CContext);<br>
>>>  }<br>
>>><br>
>>>  std::string PrettyPrintInRange(const llvm::APSInt &Value, IntRange Range)<br>
>>> {<br>
>>> @@ -4149,7 +4159,6 @@<br>
>>>         }<br>
>>>       }<br>
>>>     }<br>
>>> -    return; // Other casts to bool are not checked.<br>
>>>   }<br>
>>><br>
>>>   // Strip vector types.<br>
>>> @@ -4213,7 +4222,7 @@<br>
>>>     }<br>
>>><br>
>>>     // If the target is integral, always warn.<br>
>>> -    if ((TargetBT && TargetBT->isInteger())) {<br>
>>> +    if (TargetBT && TargetBT->isInteger()) {<br>
>>>       if (S.SourceMgr.isInSystemMacro(CC))<br>
>>>         return;<br>
>>><br>
>>> @@ -4247,6 +4256,11 @@<br>
>>>     return;<br>
>>>   }<br>
>>><br>
>>> +  // TODO: remove this early return once the false positives for<br>
>>> constant->bool<br>
>>> +  // in templates, macros, etc, are reduced or removed.<br>
>>> +  if (Target->isSpecificBuiltinType(BuiltinType::Bool))<br>
>>> +    return;<br>
>>> +<br>
>>>   IntRange SourceRange = GetExprRange(S.Context, E);<br>
>>>   IntRange TargetRange = IntRange::forTargetOfCanonicalType(S.Context,<br>
>>> Target);<br>
>>><br>
>>><br>
>>> Modified: cfe/trunk/test/Analysis/array-struct-region.c<br>
>>> URL:<br>
>>> <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/array-struct-region.c?rev=156826&r1=156825&r2=156826&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/array-struct-region.c?rev=156826&r1=156825&r2=156826&view=diff</a><br>


>>><br>
>>> ==============================================================================<br>
>>> --- cfe/trunk/test/Analysis/array-struct-region.c (original)<br>
>>> +++ cfe/trunk/test/Analysis/array-struct-region.c Tue May 15 11:56:36 2012<br>
>>> @@ -25,8 +25,8 @@<br>
>>>  }<br>
>>><br>
>>>  void nested_compound_literals(int rad) {<br>
>>> -  int vec[6][2] = {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169},  //<br>
>>> expected-warning 6 {{implicit conversion turns literal floating-point number<br>
>>> into integer}}<br>
>>> -                   {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}}; //<br>
>>> expected-warning 6 {{implicit conversion turns literal floating-point number<br>
>>> into integer}}<br>
>>> +  int vec[6][2] = {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169},  //<br>
>>> expected-warning 6 {{implicit conversion from 'double' to 'int' changes<br>
>>> value from}}<br>
>>> +                   {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}}; //<br>
>>> expected-warning 6 {{implicit conversion from 'double' to 'int' changes<br>
>>> value from}}<br>
>>>   int a;<br>
>>><br>
>>>   for (a = 0; a < 6; ++a) {<br>
>>><br>
>>> Modified: cfe/trunk/test/CXX/expr/expr.unary/expr.unary.op/p6.cpp<br>
>>> URL:<br>
>>> <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/expr/expr.unary/expr.unary.op/p6.cpp?rev=156826&r1=156825&r2=156826&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/expr/expr.unary/expr.unary.op/p6.cpp?rev=156826&r1=156825&r2=156826&view=diff</a><br>


>>><br>
>>> ==============================================================================<br>
>>> --- cfe/trunk/test/CXX/expr/expr.unary/expr.unary.op/p6.cpp (original)<br>
>>> +++ cfe/trunk/test/CXX/expr/expr.unary/expr.unary.op/p6.cpp Tue May 15<br>
>>> 11:56:36 2012<br>
>>> @@ -4,7 +4,7 @@<br>
>>><br>
>>>  bool b = !0;<br>
>>><br>
>>> -bool b2 = !1.2;<br>
>>> +bool b2 = !1.2; //expected-warning{{implicit conversion from 'double' to<br>
>>> 'bool' changes value from 1.2 to true}}<br>
>>><br>
>>>  bool b3 = !4;<br>
>>><br>
>>><br>
>>> Modified: cfe/trunk/test/CXX/temp/temp.spec/p5.cpp<br>
>>> URL:<br>
>>> <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.spec/p5.cpp?rev=156826&r1=156825&r2=156826&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.spec/p5.cpp?rev=156826&r1=156825&r2=156826&view=diff</a><br>


>>><br>
>>> ==============================================================================<br>
>>> --- cfe/trunk/test/CXX/temp/temp.spec/p5.cpp (original)<br>
>>> +++ cfe/trunk/test/CXX/temp/temp.spec/p5.cpp Tue May 15 11:56:36 2012<br>
>>> @@ -14,7 +14,7 @@<br>
>>>  };<br>
>>><br>
>>>  template<typename T><br>
>>> -T X0<T>::value = 3.14; // expected-warning{{implicit conversion turns<br>
>>> literal floating-point number into integer}}<br>
>>> +T X0<T>::value = 3.14; // expected-warning{{implicit conversion from<br>
>>> 'double' to 'int' changes value from 3.14 to 3}}<br>
>>><br>
>>>  template struct X0<int>; // expected-note{{previous explicit<br>
>>> instantiation}} \<br>
>>>                             expected-note{{requested here}}<br>
>>><br>
>>> Modified: cfe/trunk/test/PCH/exprs.h<br>
>>> URL:<br>
>>> <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/exprs.h?rev=156826&r1=156825&r2=156826&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/exprs.h?rev=156826&r1=156825&r2=156826&view=diff</a><br>


>>><br>
>>> ==============================================================================<br>
>>> --- cfe/trunk/test/PCH/exprs.h (original)<br>
>>> +++ cfe/trunk/test/PCH/exprs.h Tue May 15 11:56:36 2012<br>
>>> @@ -87,7 +87,7 @@<br>
>>>   int x;<br>
>>>   float y;<br>
>>>  } designated_inits[3] = { [0].y = 17,<br>
>>> -                          [2].x = 12.3, // expected-warning {{implicit<br>
>>> conversion turns literal floating-point number into integer}}<br>
>>> +                          [2].x = 12.3, // expected-warning {{implicit<br>
>>> conversion from 'double' to 'int' changes value from 12.3 to 12}}<br>
>>>                           3.5 };<br>
>>><br>
>>>  // TypesCompatibleExpr<br>
>>><br>
>>> Modified: cfe/trunk/test/Sema/array-init.c<br>
>>> URL:<br>
>>> <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/array-init.c?rev=156826&r1=156825&r2=156826&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/array-init.c?rev=156826&r1=156825&r2=156826&view=diff</a><br>


>>><br>
>>> ==============================================================================<br>
>>> --- cfe/trunk/test/Sema/array-init.c (original)<br>
>>> +++ cfe/trunk/test/Sema/array-init.c Tue May 15 11:56:36 2012<br>
>>> @@ -50,7 +50,7 @@<br>
>>><br>
>>>   static long x2[3] = { 1.0,<br>
>>>                         "abc", // expected-warning{{incompatible pointer<br>
>>> to integer conversion initializing 'long' with an expression of type 'char<br>
>>> [4]'}}<br>
>>> -                         5.8 }; // expected-warning {{implicit conversion<br>
>>> turns literal floating-point number into integer}}<br>
>>> +                         5.8 }; // expected-warning {{implicit conversion<br>
>>> from 'double' to 'long' changes value from 5.8 to 5}}<br>
>>>  }<br>
>>><br>
>>>  void test() {<br>
>>><br>
>>> Modified: cfe/trunk/test/Sema/knr-def-call.c<br>
>>> URL:<br>
>>> <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/knr-def-call.c?rev=156826&r1=156825&r2=156826&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/knr-def-call.c?rev=156826&r1=156825&r2=156826&view=diff</a><br>


>>><br>
>>> ==============================================================================<br>
>>> --- cfe/trunk/test/Sema/knr-def-call.c (original)<br>
>>> +++ cfe/trunk/test/Sema/knr-def-call.c Tue May 15 11:56:36 2012<br>
>>> @@ -36,6 +36,6 @@<br>
>>>  }<br>
>>><br>
>>>  void use_proto() {<br>
>>> -  proto(42.1); // expected-warning{{implicit conversion turns literal<br>
>>> floating-point number into integer}}<br>
>>> -  (&proto)(42.1); // expected-warning{{implicit conversion turns literal<br>
>>> floating-point number into integer}}<br>
>>> +  proto(42.1); // expected-warning{{implicit conversion from 'double' to<br>
>>> 'int' changes value from 42.1 to 42}}<br>
>>> +  (&proto)(42.1); // expected-warning{{implicit conversion from 'double'<br>
>>> to 'int' changes value from 42.1 to 42}}<br>
>>>  }<br>
>>><br>
>>> Modified: cfe/trunk/test/SemaCXX/bool.cpp<br>
>>> URL:<br>
>>> <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/bool.cpp?rev=156826&r1=156825&r2=156826&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/bool.cpp?rev=156826&r1=156825&r2=156826&view=diff</a><br>


>>><br>
>>> ==============================================================================<br>
>>> --- cfe/trunk/test/SemaCXX/bool.cpp (original)<br>
>>> +++ cfe/trunk/test/SemaCXX/bool.cpp Tue May 15 11:56:36 2012<br>
>>> @@ -1,4 +1,4 @@<br>
>>> -// RUN: %clang_cc1 -fsyntax-only -verify %s<br>
>>> +// RUN: %clang_cc1 -fsyntax-only -verify -Wno-constant-conversion %s<br>
>>><br>
>>>  // Bool literals can be enum values.<br>
>>>  enum {<br>
>>><br>
>>> Modified: cfe/trunk/test/SemaCXX/conversion.cpp<br>
>>> URL:<br>
>>> <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/conversion.cpp?rev=156826&r1=156825&r2=156826&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/conversion.cpp?rev=156826&r1=156825&r2=156826&view=diff</a><br>


>>><br>
>>> ==============================================================================<br>
>>> --- cfe/trunk/test/SemaCXX/conversion.cpp (original)<br>
>>> +++ cfe/trunk/test/SemaCXX/conversion.cpp Tue May 15 11:56:36 2012<br>
>>> @@ -65,7 +65,7 @@<br>
>>>   int c = ((((NULL)))); // expected-warning {{implicit conversion of NULL<br>
>>> constant to 'int'}}<br>
>>>   int d;<br>
>>>   d = ((((NULL)))); // expected-warning {{implicit conversion of NULL<br>
>>> constant to 'int'}}<br>
>>> -  bool bl = NULL; // FIXME: this should warn but we currently suppress a<br>
>>> bunch of conversion-to-bool warnings including this one<br>
>>> +  bool bl = NULL; // expected-warning {{implicit conversion of NULL<br>
>>> constant to 'bool'}}<br>
>>>   char ch = NULL; // expected-warning {{implicit conversion of NULL<br>
>>> constant to 'char'}}<br>
>>>   unsigned char uch = NULL; // expected-warning {{implicit conversion of<br>
>>> NULL constant to 'unsigned char'}}<br>
>>>   short sh = NULL; // expected-warning {{implicit conversion of NULL<br>
>>> constant to 'short'}}<br>
>>> @@ -104,3 +104,12 @@<br>
>>>     tmpl2<int*>();<br>
>>>   }<br>
>>>  }<br>
>>> +<br>
>>> +namespace test5 {<br>
>>> +  template<int I><br>
>>> +  void func() {<br>
>>> +    bool b = I;<br>
>>> +  }<br>
>>> +<br>
>>> +  template void func<3>();<br>
>>> +}<br>
>>><br>
>>> Modified: cfe/trunk/test/SemaCXX/expressions.cpp<br>
>>> URL:<br>
>>> <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/expressions.cpp?rev=156826&r1=156825&r2=156826&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/expressions.cpp?rev=156826&r1=156825&r2=156826&view=diff</a><br>


>>><br>
>>> ==============================================================================<br>
>>> --- cfe/trunk/test/SemaCXX/expressions.cpp (original)<br>
>>> +++ cfe/trunk/test/SemaCXX/expressions.cpp Tue May 15 11:56:36 2012<br>
>>> @@ -1,4 +1,4 @@<br>
>>> -// RUN: %clang_cc1 -fsyntax-only -verify %s<br>
>>> +// RUN: %clang_cc1 -fsyntax-only -verify -Wno-constant-conversion %s<br>
>>><br>
>>>  void choice(int);<br>
>>>  int choice(bool);<br>
>>><br>
>>> Modified: cfe/trunk/test/SemaCXX/overload-call.cpp<br>
>>> URL:<br>
>>> <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/overload-call.cpp?rev=156826&r1=156825&r2=156826&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/overload-call.cpp?rev=156826&r1=156825&r2=156826&view=diff</a><br>


>>><br>
>>> ==============================================================================<br>
>>> --- cfe/trunk/test/SemaCXX/overload-call.cpp (original)<br>
>>> +++ cfe/trunk/test/SemaCXX/overload-call.cpp Tue May 15 11:56:36 2012<br>
>>> @@ -233,7 +233,7 @@<br>
>>><br>
>>>  void intref_test() {<br>
>>>   float* ir1 = intref(5);<br>
>>> -  float* ir2 = intref(5.5); // expected-warning{{implicit conversion<br>
>>> turns literal floating-point number into integer}}<br>
>>> +  float* ir2 = intref(5.5); // expected-warning{{implicit conversion from<br>
>>> 'double' to 'int' changes value from 5.5 to 5}}<br>
>>>  }<br>
>>><br>
>>>  void derived5(C&); // expected-note{{candidate function not viable:<br>
>>> cannot bind base class object of type 'A' to derived class reference 'C &'<br>
>>> for 1st argument}}<br>
>>><br>
>>> Modified: cfe/trunk/test/SemaCXX/warn-literal-conversion.cpp<br>
>>> URL:<br>
>>> <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-literal-conversion.cpp?rev=156826&r1=156825&r2=156826&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-literal-conversion.cpp?rev=156826&r1=156825&r2=156826&view=diff</a><br>


>>><br>
>>> ==============================================================================<br>
>>> --- cfe/trunk/test/SemaCXX/warn-literal-conversion.cpp (original)<br>
>>> +++ cfe/trunk/test/SemaCXX/warn-literal-conversion.cpp Tue May 15 11:56:36<br>
>>> 2012<br>
>>> @@ -5,29 +5,29 @@<br>
>>>  // Warn when a literal float or double is assigned or bound to an<br>
>>> integer.<br>
>>>  void test0() {<br>
>>>   // Float<br>
>>> -  int y0 = 1.2222F; // expected-warning {{implicit conversion turns<br>
>>> literal floating-point number into integer}}<br>
>>> -  int y1 = (1.2222F); // expected-warning {{implicit conversion turns<br>
>>> literal floating-point number into integer}}<br>
>>> -  int y2 = (((1.2222F))); // expected-warning {{implicit conversion turns<br>
>>> literal floating-point number into integer}}<br>
>>> -  int y3 = 12E-1F; // expected-warning {{implicit conversion turns<br>
>>> literal floating-point number into integer}}<br>
>>> -  int y4 = 1.23E1F; // expected-warning {{implicit conversion turns<br>
>>> literal floating-point number into integer}}<br>
>>> +  int y0 = 1.2222F; // expected-warning {{implicit conversion from<br>
>>> 'float' to 'int' changes value from 1.2222 to 1}}<br>
>>> +  int y1 = (1.2222F); // expected-warning {{implicit conversion from<br>
>>> 'float' to 'int' changes value from 1.2222 to 1}}<br>
>>> +  int y2 = (((1.2222F))); // expected-warning {{implicit conversion from<br>
>>> 'float' to 'int' changes value from 1.2222 to 1}}<br>
>>> +  int y3 = 12E-1F; // expected-warning {{implicit conversion from 'float'<br>
>>> to 'int' changes value from 1.2 to 1}}<br>
>>> +  int y4 = 1.23E1F; // expected-warning {{implicit conversion from<br>
>>> 'float' to 'int' changes value from 12.3 to 12}}<br>
>>>   // Double<br>
>>> -  int y5 = 1.2222; // expected-warning {{implicit conversion turns<br>
>>> literal floating-point number into integer}}<br>
>>> -  int y6 = 12E-1; // expected-warning {{implicit conversion turns literal<br>
>>> floating-point number into integer}}<br>
>>> -  int y7 = 1.23E1; // expected-warning {{implicit conversion turns<br>
>>> literal floating-point number into integer}}<br>
>>> -  int y8 = (1.23E1); // expected-warning {{implicit conversion turns<br>
>>> literal floating-point number into integer}}<br>
>>> +  int y5 = 1.2222; // expected-warning {{implicit conversion from<br>
>>> 'double' to 'int' changes value from 1.2222 to 1}}<br>
>>> +  int y6 = 12E-1; // expected-warning {{implicit conversion from 'double'<br>
>>> to 'int' changes value from 1.2 to 1}}<br>
>>> +  int y7 = 1.23E1; // expected-warning {{implicit conversion from<br>
>>> 'double' to 'int' changes value from 12.3 to 12}}<br>
>>> +  int y8 = (1.23E1); // expected-warning {{implicit conversion from<br>
>>> 'double' to 'int' changes value from 12.3 to 12}}<br>
>>><br>
>>>   // Test assignment to an existing variable.<br>
>>> -  y8 = 2.22F; // expected-warning {{implicit conversion turns literal<br>
>>> floating-point number into integer}}<br>
>>> +  y8 = 2.22F; // expected-warning {{implicit conversion from 'float' to<br>
>>> 'int' changes value from 2.22 to 2}}<br>
>>><br>
>>>   // Test direct initialization.<br>
>>> -  int y9(1.23F); // expected-warning {{implicit conversion turns literal<br>
>>> floating-point number into integer}}<br>
>>> +  int y9(1.23F); // expected-warning {{implicit conversion from 'float'<br>
>>> to 'int' changes value from 1.23 to 1}}<br>
>>><br>
>>>   // Test passing a literal floating-point value to a function that takes<br>
>>> an integer.<br>
>>> -  foo(1.2F); // expected-warning {{implicit conversion turns literal<br>
>>> floating-point number into integer}}<br>
>>> +  foo(1.2F); // expected-warning {{implicit conversion from 'float' to<br>
>>> 'int' changes value from 1.2 to 1}}<br>
>>><br>
>>> -  int y10 = -1.2F;  // expected-warning {{implicit conversion turns<br>
>>> literal floating-point number into integer}}<br>
>>> +  int y10 = -1.2F;  // expected-warning {{implicit conversion from<br>
>>> 'float' to 'int' changes value from 1.2 to 1}}<br>
>>><br>
>>> -  // -Wconversion-literal does NOT catch const values.<br>
>>> +  // -Wliteral-conversion does NOT catch const values.<br>
>>>   // (-Wconversion DOES catch them.)<br>
>>>   static const float sales_tax_rate = .095F;<br>
>>>   int z = sales_tax_rate;<br>
>>><br>
>>> Modified: cfe/trunk/test/SemaTemplate/member-template-access-expr.cpp<br>
>>> URL:<br>
>>> <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/member-template-access-expr.cpp?rev=156826&r1=156825&r2=156826&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/member-template-access-expr.cpp?rev=156826&r1=156825&r2=156826&view=diff</a><br>


>>><br>
>>> ==============================================================================<br>
>>> --- cfe/trunk/test/SemaTemplate/member-template-access-expr.cpp (original)<br>
>>> +++ cfe/trunk/test/SemaTemplate/member-template-access-expr.cpp Tue May 15<br>
>>> 11:56:36 2012<br>
>>> @@ -60,7 +60,7 @@<br>
>>><br>
>>>  void test_X1(X1 x1) {<br>
>>>   float *fp1 = x1.f1<>(17);<br>
>>> -  float *fp2 = x1.f1<int>(3.14); // expected-warning {{implicit<br>
>>> conversion turns literal floating-point number into integer}}<br>
>>> +  float *fp2 = x1.f1<int>(3.14); // expected-warning {{implicit<br>
>>> conversion from 'double' to 'int' changes value from 3.14 to 3}}<br>
>>>   int *ip1 = x1.f1(17);<br>
>>>   float *ip2 = x1.f1(3.14);<br>
>>><br>
>>><br>
>>><br>
>>> _______________________________________________<br>
>>> cfe-commits mailing list<br>
>>> <a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">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>
>><br>
>><br>
</div></div></blockquote></div></div></div><br>
</blockquote></div><br>