<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jun 17, 2013 at 6:40 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class=""><div class="h5">On Mon, Jun 17, 2013 at 6:27 PM, Larisse Voufo <<a href="mailto:lvoufo@google.com">lvoufo@google.com</a>> wrote:<br>
> Author: lvoufo<br>
> Date: Mon Jun 17 20:27:47 2013<br>
> New Revision: 184165<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=184165&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=184165&view=rev</a><br>
> Log:<br>
> r184100 Fix -- Updated test cases for contextual conversion<br>
><br>
> Modified:<br>
> cfe/trunk/lib/Sema/SemaExprCXX.cpp<br>
> cfe/trunk/test/SemaCXX/cxx1y-contextual-conversion-tweaks.cpp<br>
> cfe/trunk/test/SemaCXX/cxx98-compat-pedantic.cpp<br>
><br>
> Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=184165&r1=184164&r2=184165&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=184165&r1=184164&r2=184165&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)<br>
> +++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Mon Jun 17 20:27:47 2013<br>
> @@ -1205,9 +1205,9 @@ Sema::BuildCXXNew(SourceRange Range, boo<br>
> AA_Converting);<br>
><br>
> if (!isSFINAEContext())<br>
> - // Diagnose the compatibility of this conversion.<br>
> - Diag(StartLoc, diag::warn_cxx98_compat_array_size_conversion)<br>
> - << ArraySize->getType() << 0 << Context.getSizeType();<br>
> + // Diagnose the compatibility of this conversion.<br>
> + Diag(StartLoc, diag::warn_cxx98_compat_array_size_conversion)<br>
> + << ArraySize->getType() << 0 << "'size_t'";<br>
<br>
</div></div>This warning is firing in too many cases. For instance:<br>
<br>
int *p = new int[1];<br>
<br>
triggers it. This should only warn if the source type is a class type.<br>
Also, you don't need the SFINAE context check here.<br></blockquote><div><br></div><div>Ok. Fixed. (cf. r184167).</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class=""><div class="h5"><br>
> } else {<br>
> class SizeConvertDiagnoser : public ICEConvertDiagnoser {<br>
> protected:<br>
><br>
> Modified: cfe/trunk/test/SemaCXX/cxx1y-contextual-conversion-tweaks.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx1y-contextual-conversion-tweaks.cpp?rev=184165&r1=184164&r2=184165&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx1y-contextual-conversion-tweaks.cpp?rev=184165&r1=184164&r2=184165&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/test/SemaCXX/cxx1y-contextual-conversion-tweaks.cpp (original)<br>
> +++ cfe/trunk/test/SemaCXX/cxx1y-contextual-conversion-tweaks.cpp Mon Jun 17 20:27:47 2013<br>
> @@ -154,4 +154,24 @@ namespace extended_examples_cxx1y {<br>
> //expected-error@143 {{cannot initialize object parameter of type 'extended_examples_cxx1y::D' with an expression of type 'extended_examples_cxx1y::D'}}<br>
> #endif<br>
><br>
> -// FIXME: Extend with more examples, including [expr.const] and [expr.new].<br>
> +namespace extended_examples_array_bounds {<br>
> +<br>
> + typedef decltype(sizeof(int)) size_t;<br>
> +<br>
> + struct Foo {<br>
> + operator size_t(); // @162<br>
> + operator unsigned short(); // @163<br>
> + };<br>
> +<br>
> + void bar() {<br>
> + Foo x;<br>
> + int *p = new int[x]; // @168<br>
> + }<br>
> +}<br>
> +<br>
> +#ifdef CXX1Y<br>
> +#else<br>
> +//expected-error@168 {{ambiguous conversion of array size expression of type 'extended_examples_array_bounds::Foo' to an integral or enumeration type}}<br>
> +//expected-note@162 {{conversion to integral type 'size_t'}}<br>
> +//expected-note@163 {{conversion to integral type 'unsigned short' declared here}}<br>
> +#endif<br>
><br>
> Modified: cfe/trunk/test/SemaCXX/cxx98-compat-pedantic.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx98-compat-pedantic.cpp?rev=184165&r1=184164&r2=184165&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx98-compat-pedantic.cpp?rev=184165&r1=184164&r2=184165&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/test/SemaCXX/cxx98-compat-pedantic.cpp (original)<br>
> +++ cfe/trunk/test/SemaCXX/cxx98-compat-pedantic.cpp Mon Jun 17 20:27:47 2013<br>
> @@ -34,7 +34,7 @@ struct ConvertToInt {<br>
> };<br>
> int *ArraySizeConversion = new int[ConvertToInt()];<br>
> #ifdef CXX1Y2<br>
> -// expected-warning@-2 {{implicit conversion from array size expression of type 'ConvertToInt' to integral type}} // 'unsigned long' is incompatible with C++98}}<br>
> +// expected-warning@-2 {{implicit conversion from array size expression of type 'ConvertToInt' to integral type 'size_t' is incompatible with C++98}}<br>
> #else<br>
> // expected-warning@-4 {{implicit conversion from array size expression of type 'ConvertToInt' to integral type 'int' is incompatible with C++98}}<br>
> #endif<br>
><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" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</div></div></blockquote></div><br></div></div>