https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102236
Bug ID: 102236
Summary: emplace_deref is not constexpr for join_view
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
For instance:
#include <ranges>
constexpr std::string_view first_n_words(std::string_view str, size_t n) {
namespace rv = std::views;
auto first_n = str
| rv::split(' ')
| rv::take(n)
| rv::join;
return std::string_view(&*first_n.begin(), std::ranges::distance(first_n));
}
constexpr std::string_view first4 = first_n_words("Hello to all you beautiful
libstdc++ developers", 4);
This doesn't compile because _M_emplace_deref isn't marked constexpr (probably
becase P2231 isn't implemented yet, but thought I'd file a bug report anyway).