<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/111510>111510</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Noisy cppcoreguidelines-narrowing-conversions warning for types subject to arithmetic conversion
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
chrchr-github
</td>
</tr>
</table>
<pre>
~~~c++
void f(short& a, short b, short c) {
a = b + c;
}
~~~
~~~
<source>:2:9: warning: narrowing conversion from 'int' to signed type 'short' is implementation-defined [bugprone-narrowing-conversions]
2 | a = b + c;
|
~~~
https://godbolt.org/z/913zov7vz
Maybe there could be an option to suppress the warning in case all types involved are the same? I don't see how adding a cast would improve the example.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0U82uozwMfRqzsVpB0jZlwaK9_ZC-xcw75MeFjCBBSaDTu-izj8Lt3I6uZiQkjI597HNsZIy2c0QN7M-wvxRyTr0Pje6D7sOms6mfVaG8uTePx0MDO-envEB5Wrw1eAV2jL0PCdgBJbA3XL9QvUINrEYQzypERInAL6gQ2Bk18CcC4vIRPB6PLwHwt-jnoAn4f8BPDPipBn7CmwzOui6HTobgb9Z1qL1bKETrHV6DHxGYsC4BE5g8rmINpvtEGXiOLtBGtOM00EguyWS92xi62pwK-7Oauyl4R5vPJptXkwj7y0saQxBv-G-RGf4irk9pisBPwFpgbeeN8kPa-tABa9-BtXXF3_0ilveP9G_yrghTT4FQ-3kwqAilQz_lsVeN8zQFijEn_bYIrUMtI6EchlV9ROsWPyxkUIaVD6McCXiL_6PxDphIGImw9zeUxmQOmSkS3taudpyCXz4q6afM5m0L03BT81oW1FSCHfmxrCtR9E2tSCpS2lwPxx2rDkdTcsE0V6pU1Y5MYRtWsl1Vlsey3h252EomeC2k0ILVpaID7EoapR22w7CM2Z3CxjhTU1XVviqLQSoa4nrEjDm64YoCY_mmQ5OLNmruIuzKwcYUXzTJpoGa797GO-pp0j5QN1tDg3UU_77xT1OvPjzNjLP6QTpl-2WwqR8pWf3HKRZzGJovm17_ra32I7A2j_N8babgMxewdhURgbVPlUvDfgUAAP__IfQv1w">