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

    <tr>
        <th>Summary</th>
        <td>
            clang-tidy: bugprone-dangling-handle works with foo{"a"} but not foo("a")
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          sean-mcmanus
      </td>
    </tr>
</table>

<pre>
    Repro is using clang-tidy 17.0.1 on the code below with -std=c++17 and https://releases.llvm.org/17.0.1/tools/clang/tools/extra/docs/clang-tidy/checks/bugprone/dangling-handle.html . See https://github.com/llvm/llvm-project/issues/54984 for an example command line (this issue seems different from that bug).

```cpp
#include <cstddef>
#include <string>
#include <string_view>

struct foo {
    std::string sss;
    explicit foo(std::string_view sss): sss{sss}{}
    operator std::string_view()
 const noexcept
    {
        return { sss.data(), sss.size() };
    }
};

size_t func()
{
    const std::string_view test1 = foo("a"); // no bugprone-dangling-handle
    const std::string_view test2 = foo{"a"}; // bugprone-dangling-handle
 return test1.length() + test2.length();
}
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVFuuozgQXY35KQWBHQh88JF0JguYWUDLmAI8bWxkF31v9-pHmLxu5s5DHUVOXK9z6lCUDEEPFrFhxYkV50QuNDrfBJR2N6lJ2iUkret-NL_j7B3oAEvQdgBlpB12pLsfkB_SLM3BWaARQbkOoUXj3uBN0wi7QB0TZ8X4ifFTfgBpOxiJ5sDEkfEL4xePBmXAkBrzfUqdHxi_bEUZv5BzJjB-iYBPd3wnLxm_dE7d3ZHPehlRfVut7TLM3llc46QdjLbDbpS2M5iONBlI4Q_EFzaDpnFpU-Umxi8ro-vPbvbuT1TE-EWHsOBav9jX1R5650FawHc5zWZVYJrWJo22CIxXNOoAMQUC4hSg032PHi1B790ENEqCdhkYr1OWnVl2vJ5ltn3VPF8tXGirzNIhMPFFBeo67Jn47TNvIK_t8K_Or981vj0i4hnIL4qgdw7Y4bTZAADiUzwycdxSIYTAxJMf32ejlY6ZjFcv4REp5vCaiWP8dzjF87zCHM6PSm5GL8n5V8iNLa_WEluwcjYQWIfvCmd6VPhAfP14pMXb1b4ip50keS3Ev0RL0D9xs8DK5bmxO7dnx1Ur_RO_EvSLVc-8PsBvHD-VgzBQDkycr5oxziXjPEp0gm0YwTq4DfHuZYT_Nwi_gxxON5DYzA3kPxCu8kW-qUE70HgTi582hA_mh0x37W6jvF2TrhFdLWqZYJOXdVlVVVGLZGxyVeaVPJS8L1AUXddL1Ze5KIpMdb3kPNENz7jIs6zmeVEKkfZcVIUo6rIX-7auBNtnOElt7rskiW9eU1alOCRGtmhC3HWcP68Mvu4-38T3vF2GwPaZ0YEeKykhTQabpxxx_Efd4M35b2Hbf6-yQ7usM0t_e-jJ4k3z66soNvhXAAAA___GP8Py">