Bug 102236 - emplace_deref is not constexpr for join_view
Summary: emplace_deref is not constexpr for join_view
Status: RESOLVED DUPLICATE of bug 101263
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 12.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-09-07 23:20 UTC by Barry Revzin
Modified: 2021-09-08 07:42 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Barry Revzin 2021-09-07 23:20:04 UTC
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).
Comment 1 康桓瑋 2021-09-08 02:25:31 UTC
This is obviously a dup of PR101263 ;-)
Comment 2 Richard Biener 2021-09-08 07:42:11 UTC
dup

*** This bug has been marked as a duplicate of bug 101263 ***