Issue |
152337
|
Summary |
Static inline member initialization bug on multiple template variable instantiations
|
Labels |
new issue
|
Assignees |
|
Reporter |
plopresti
|
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)
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs