https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114530
Bug ID: 114530 Summary: accessing 'std::__cxx11::basic_string<char>::<unnamed union>::_M_allocated_capacity' member instead of initialized 'std::__cxx11::basic_string<char>::<unnamed union>::_M_local_buf' member in constant expression Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: hewillk at gmail dot com Target Milestone: --- GCC rejects the following: #include <ranges> #include <vector> static_assert( std::ranges::distance( std::views::single(std::views::cartesian_product(std::string{})) | std::views::join ) == 0 ); https://godbolt.org/z/4xcYxsMW4 The above seems to be a valid constant expression. It is worth noting that replacing std::string{} with std::vector<int>{} compiles fine, see https://godbolt.org/z/bKdexfzcz It's unclear whether this is a library bug or a language bug.