public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/103924] New: views::join combined with std::string cannot be used in constant expressions
@ 2022-01-06  1:56 hewillk at gmail dot com
  2022-01-06 13:46 ` [Bug libstdc++/103924] " ppalka at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: hewillk at gmail dot com @ 2022-01-06  1:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103924

            Bug ID: 103924
           Summary: views::join combined with std::string cannot be used
                    in constant expressions
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

The following code cannot be used as a constant expression, but it should work
since constexpr non-propagating-cache and std::string have been implemented.

#include <string>
#include <ranges>

int main() {
  using namespace std::string_literals;
  static_assert(std::ranges::distance(
      std::views::single("42"s) | std::views::join));
}

https://godbolt.org/z/zPv4xnxnP

#include <string>
#include <ranges>

int main() {
  using namespace std::string_literals;
  static_assert(std::ranges::distance(
      std::views::iota(0, 1) 
      | std::views::transform([](auto) { return "42"s; })
      | std::views::join));
}

https://godbolt.org/z/d5TM4x53z

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-03-30  1:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-06  1:56 [Bug libstdc++/103924] New: views::join combined with std::string cannot be used in constant expressions hewillk at gmail dot com
2022-01-06 13:46 ` [Bug libstdc++/103924] " ppalka at gcc dot gnu.org
2022-10-04 14:41 ` ppalka at gcc dot gnu.org
2024-03-29 21:20 ` ppalka at gcc dot gnu.org
2024-03-29 21:21 ` ppalka at gcc dot gnu.org
2024-03-30  1:13 ` hewillk at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).