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

    <tr>
        <th>Summary</th>
        <td>
            Clang accepts invalid program involving static_cast from class type to const bool& with conversion operator
        </td>
    </tr>

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

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

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

<pre>
    The following invalid program is accepted by clang. [Demo](https://godbolt.org/z/oM33ffsEG)

```

struct C {
 explicit operator bool() const {
        return true;
    }
};
 
int main() {

    C c;

    auto b = static_cast<const bool &>(c);//accepted by clang only

}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxkkkGPmz4QxT_NcBltBGMI8YHDJiz_0__We2WMQ1wZG9lDtumnr0jSJO0ihKWxZ3jv56dSsqM3poFqD1WbqYVPITZReaV8CHPWh-HSfDsZPAbnwqf1I1p_Vs4OOMcwRjWhTai0NjObAfsLaqf8uEGo9q2ZAlQt0O7EPCcQ70AdUDeGoQ-ONyGOQN0voC78L8TxmD7-A5KQt5C_37_b_P6-FBPHRTMeEOr9rYLm5-ystoxhNlFxiNiH4IB2QBJ18IlfDt-faHiJHjkuBsTLHtTt_W91-9y4LdYzTsr6--THzGf3AfWj6VlVCwfsEUSLiRVb_V2rxCAON22rWATagvgA2ukVgtjfWH0hi8G7y1-MHnr_wMqGRgxSSJWZpqipIKrquspOjax1IXKzrXIjSA61krKW27I3QylLqUVmG8qpzOuiLspiW5SbkgZV1qYXw-6ojNhBmZtJWbdx7jytF5jZlBbTSClIZk71xqVrloiuaoFojVVs1vNv_TImKHNnE6fnBLbsTHO4mrvZTV8z5s_Bndf0vfDDYwzTSiUl5MtskAM-gQJt8dPyaS2dTUw2-Ec8siW65p9QWj4t_UaHCahbtd2XtzmGH0YzUHe1moC6m9tzQ78DAAD__9Bf-tk">