Closed
Description
The following code compiles with libstd++, but not libc++:
#include <iostream>
#include <string>
struct S {
std::string s_;
};
constexpr S s{"Test"};
int main() {
std::cout << s.s_;
return 0;
}
Online repro: https://godbolt.org/z/fjdnrPceh
It seems like either this is legal or it isn't. I'm not well-versed in the minutiae of constexpr std::strings in C++20, but my layman's impression is that this ought to work, so libstdc++ is correct and libc++ is wrong?