This is not a bug in MSVC, rather it is due to MSVC implementing std::string SSO differently than gcc or clang. Instead of initializing `data` as pointing to the internal buffer for small strings, MSVC uses the string's capacity to determine whether to access `data` or the internal storage [2].
Hence this code compiles, as it's not initializing the string using a stack address. [3]
[1]: https://godbolt.org/z/1ErrKjdbq
[2]: https://devblogs.microsoft.com/oldnewthing/20230803-00/?p=10...