<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/61678>61678</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [rejects-valid] -Wimplicit-float-conversion warning flagged as -Wc++11-narrowing error when using -ftrapping-math
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          dfrib
      </td>
    </tr>
</table>

<pre>
    Consider the following snippet, covering an example of narrowing in list-initialization, and an example of (non-narrowing) precision loss in list-initialization, where the former is ill-formed whereas the latter is well-formed when the source of the initialization is a constant expression:

```.cpp
float ill_formed_narrowing_by_overflow{1e50};
  // error: -Wc++11-narrowing
  // warning: -Wimplicit-float-conversion

float well_formed_loss_of_precision{1 / 3.6};
  // warning: -Wimplicit-float-conversion
  // (+)

float well_formed_no_loss_of_precision{1 / 2.0};
  // no warning
```

Clang's diagnostics are as expected (see comments in snippet) when compiled with:
```bash
-std=c++20 -Wimplicit-float-conversion 
```

However, when adding the `trapping-math` flag:
```bash
-std=c++20 -Wimplicit-float-conversion -ftrapping-math
```

the initialization of `well_formed_loss_of_precision`  (`(+)` in snippet) is misidentified as narrowing and is rejected as ill-formed via inclusion in the `c++11-narrowing` diagnostics family.

As a guess, potentially adding `-ftrapping-math` results in the constant expression `1 / 3.6` no longer being treated as a constant expression.

Tested via godbolt for various Clang version, [demo here](https://godbolt.org/z/nfhPbhdd9) for Clang 16.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVcGO8jgTfBpzsYKMAwYOHIZB6D_-h5X2iJy4k_TKsSPbgW--p1-1A8yAWKSVVhoNiu12V3dXlXWM2DqAHVvt2eow02PqfNiZJmA1q7z52n16F9FA4KkD3nhr_QVdy6PDYYDE5Cev_RkCrWnH4ZfuBwvcN9zpEKaz6LjFmAp0mFBb_K0Tekeh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