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

    <tr>
        <th>Summary</th>
        <td>
            Static inline member initialization bug on multiple template variable instantiations
        </td>
    </tr>

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

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

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

<pre>
    In the following program:

```
#include <string_view>
#include <cassert>

template<typename T>
static std::string_view type_str = T::str;

template<typename T>
class Bug
{
public:
    inline static const char hello[] = "hello";
 inline static std::string_view str = hello;
};

int
main()
{
 assert(!type_str<Bug<int>>.empty()); // line 18
 assert(!type_str<Bug<float>>.empty()); // line 19
}

```

...I expect neither assertion to be triggered. With Clang, the assertion on line 19 is triggered (but not line 18).

All Clang versions I have tried (through 20.1.0) are affected.

[Live on godbolt](https://godbolt.org/z/EbsKzjGhn)

</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMU0uPpDYQ_jXmUloENnTDgUM_pqNRckukHFc2VEOtjI3soiczvz7iMTPRbqRdCQnJ9b2qXNYxUu8QG1GeRXlN9MyDD81k_RQwMiXGd6_NswMeEO7eWv9Crocp-D7oUaiTyNbvkO1fdhJSkWvt3CEIdYkcyPVfH4QvQj39UG51jBh4L2UnxnGymlGoC79O6PSI8NdWjayZWojcLbbq9B9lWLBfIwcQ6rrg97pQ55_KtlbHCOe5X5DHBT_NxlK79QYAQM6SQ9j9W-8iQzvoAANa67fBrcZCyu1Iys35O-r_Rn9PvTG3wMfrR3JyLLLTqMkJWQlZf6SEfXLLaf7ev1CXpRN1WWjqSainFMeJX3eurIU6g5A3IW-wJsurn0rdrde_KFbv4X_cieyUpukz4D8TtgwOiQcMuy95B-zBIHCgvseAXQp_Ew9wsdr1Ql7W7fsEe_fuBxQ_SSBkZWYG5_mjOVmnm_3J2k0OHhgieRfhGQb9WE03Lg_Bz_0AMkvzNBOyBh0Q9P2OLWO364jy_Ac9cMnQ-854y6K8ClkNzFNcbnedx15KfeiFvL0JeXsy8fe3b78NbrvDpGtUV6taJ9jkx7Io6qqWh2RoqqzMjKoKpUxuyqLLapnrtm4rVRitqntCjcxkmVXZIT8UVXFI62MllWzLojvmsr4rUWQ4arKptY9xSZBQjDM2eSmVOiZWG7Rxfe9SOnyBtbqsbHlNQrOQvpi5j6LILEWOnzJMbLH5c9vlfbNHHA0GIEdM2tKbXi_IzP0yoHG2TJNFeH9-8NCBtLEI5CJrx7TiYzIH23w3QeJhNmnrRyFvS4T992UK_hu2LORtDR6FvO2dPRr5bwAAAP__lzR_yA">