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

    <tr>
        <th>Summary</th>
        <td>
            False positive Wreturn-type warning when a function either returns or throws
        </td>
    </tr>

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

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

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

<pre>
    Clang does not appear to be able to deduce that a function that always throws is effectively [[noreturn]], not even in seemingly trivial cases. Consider this:
```
void throwError(const std::string& msg){
    throw std::runtime_error(msg);
}

int ensureZero(const int i){
    if (i == 0) return 0;
 throwError("ERROR");
}

```
Compiling with `-Wall -Wextra -O3 -std=c++2c` yields a false positive warning:
`warning: non-void function does not return a value in all control paths [-Wreturn-type]`

</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxkU02PqzgQ_DXm0iJy7ECSA4d8TPY40mil0e5lZaADvXJsZDfk5d8_mTBfepKVYCh3dVW5TYzUOcRKFEdRnDMzcu9D9TfVPvz1T1b79lGdrHEdtB4jOM9ghgFNAPZQI5jaYnpssR0bBO4Ng4Hr6Bom75a9vZtHBO6Dv0egCHi9YsM0oX3AzHt0PiCPwYninJY6zUw4oQNyEBFv5Dr7AA40kbHQmIhxBSfvIrUYgHuKQh-EPIhSLkseJk_tk_YlBB-E2jXeRYbIbQLrQ-RArhOqhFvshNqL7VHIAwA8T30Bw-iYbvgfLnUWuE5wsT2nX3kgx4AujgH_xeA_2dJr-lGcriDUjkDos9BnkELt4akf5LPmz66FUi9vb69vQqk_Wb8LPvnbQJZcB3fiHkQp83djLeTv-IuDgfxVQz6LOjdCHYU6qkaUEh6Eto0pOGMjwuAjpXjgboJLBn04-7UH510--_uZ9ecFWaQYmIwdMQWYemi84-AtDIb7mGLP35_AnB8DptRnCVlb6Xav9ybDar0tpC6LYr3O-gr1tq3317WS2Ja7trw2aqdlsys35bUum11GlZKqkOV6r6Te6fVKIuoC67qojW5RbsVG4s2QXVk73VY-dBnFOGK13mz2hcqsqdHGeRCUcniH-WvyvDhnoUqH8nrsothIS5HjVxkmtlhdfnr3Xd2HkXDv0X2fDyTuMSyORfBhmZJsDLbqmYf5VquLUJeOuB_rVeNvQl0S9fKXD8H_jw0LdZkbjkJdFkVTpX4HAAD___LoPtY">