public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/114530] New: 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
@ 2024-03-29 15:36 hewillk at gmail dot com
  2024-03-29 21:20 ` [Bug libstdc++/114530] " ppalka at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: hewillk at gmail dot com @ 2024-03-29 15:36 UTC (permalink / raw)
  To: gcc-bugs

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.

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

* [Bug libstdc++/114530] 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
  2024-03-29 15:36 [Bug libstdc++/114530] New: 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 hewillk at gmail dot com
@ 2024-03-29 21:20 ` ppalka at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-03-29 21:20 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ppalka at gcc dot gnu.org
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Let's call this a dup of PR103924

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

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

end of thread, other threads:[~2024-03-29 21:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-29 15:36 [Bug libstdc++/114530] New: 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 hewillk at gmail dot com
2024-03-29 21:20 ` [Bug libstdc++/114530] " ppalka at gcc dot gnu.org

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).