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

    <tr>
        <th>Summary</th>
        <td>
            UB when converting a float-point value to a type that can't represent it's value
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:frontend
      </td>
    </tr>

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

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

<pre>
    clang used to flag this as undefined behavior:

```cpp
#include <limits>

void foo() {
 constexpr double d2 = std::numeric_limits<double>::max(); 
 constexpr float f = d2;
}
```

back in clang-8 but it has not since: https://godbolt.org/z/5K1da874d

Based on [conv.double p1](https://timsong-cpp.github.io/cppwp/n4659/conv.double#1) I think this is still UB.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxcksGOnDAMhp_GXKwZgQMDHDjM7BSp6nnPVUgMpJtJEAmzu336KsNW261kCVk4n-3_twzBTI65g-oC1TWTW5z92oVZjuYlG7x-75SVbsItsMbocbRywjibgDLg5jSPxrHGgWd5N34FcYb8Ead8D7UsKSVhnLKbZgTxZM3NxADi215790bj6D1QA9Qi1BfIz6i8C5HflhW13wbLqAlBXDFEnbqIs9tuvBr18y_taa9L2Mf_m3zbiSAu-JU4Wi8jjg-eJhCpIdTXf-feRxukekHj8CHCocFhi2gizjKg8xGDcYpBnHGOcQmpLfVA_eT14G08-nUC6n8D9dWPQsumLvWOvcgkp3cI1UV5dz9-rLgUUF2Bmq-4aG7Bu-mgluU4mThvw9F4oF4ty-sC1LvyVLUp_yQBiSJp-T155V52x0zAEI21-Hw5ZroTuhWtzLgr6rJu6ro9UTZ3WojmxHTSeuCqqZpWlaRORVO1Y01tMWamo5yqvCLKC9ESHYshFzwOzchCl0XVQpnzTRp7tPZ-SxpkJoSNu6LM2ybPrBzYhsfBET10BXEeV-8iOw1E6QzXLr09DNsUoMytCTF80qKJlrvnC77O7JKpd16jcRPK3dfD4o2LeJd243SyEuP7whhnGVFJB1RHXHlZObBLbgLVYa_OttV2_1m56638DahPI3x8Dsvqf7GKQP1juwDUfyx47-hPAAAA__8S7wvJ">