r173978 - Cast to remove the narrowing conversion error in c++11.
Filipe Cabecinhas
filcab at filcab.net
Wed Jan 30 14:06:25 PST 2013
Committed as r173980.
Filipe
On 30/01/2013, at 13:56, Dmitri Gribenko <gribozavr at gmail.com> wrote:
> On Wed, Jan 30, 2013 at 11:50 PM, Filipe Cabecinhas <me at filcab.net> wrote:
>> Author: filcab
>> Date: Wed Jan 30 15:50:21 2013
>> New Revision: 173978
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=173978&view=rev
>> Log:
>> Cast to remove the narrowing conversion error in c++11.
>>
>> Modified:
>> cfe/trunk/lib/Basic/Diagnostic.cpp
>>
>> Modified: cfe/trunk/lib/Basic/Diagnostic.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Diagnostic.cpp?rev=173978&r1=173977&r2=173978&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Basic/Diagnostic.cpp (original)
>> +++ cfe/trunk/lib/Basic/Diagnostic.cpp Wed Jan 30 15:50:21 2013
>> @@ -744,8 +744,8 @@ FormatDiagnostic(const char *DiagStr, co
>> const char *Pipe = ScanFormat(Argument, Argument + ArgumentLen, '|');
>> const char *FirstDollar = ScanFormat(Argument, Pipe, '$');
>> const char *SecondDollar = ScanFormat(FirstDollar + 1, Pipe, '$');
>> - const char ArgStr1[] = { '%', '0' + ArgNo };
>> - const char ArgStr2[] = { '%', '0' + ArgNo2 };
>> + const char ArgStr1[] = { '%', (char)('0' + ArgNo) };
>> + const char ArgStr2[] = { '%', (char)('0' + ArgNo2) };
>
> Hello Filipe,
>
> Please use static_cast<>.
>
> Dmitri
>
> --
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
More information about the cfe-commits
mailing list