public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "ed at catmur dot uk" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/109976] New: error: is not a constant expression in std::equal() with _GLIBCXX_DEBUG Date: Fri, 26 May 2023 03:25:52 +0000 [thread overview] Message-ID: <bug-109976-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109976 Bug ID: 109976 Summary: error: is not a constant expression in std::equal() with _GLIBCXX_DEBUG Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: ed at catmur dot uk Target Milestone: --- #define _GLIBCXX_DEBUG #include <algorithm> #include <string> constexpr bool f(std::string const& l, std::string const& r) { return std::equal(l.data(), l.data() + l.size(), r.data(), r.data() + r.size()); } constexpr bool b = f("aa", "aa"); In file included from c++/14.0.0/debug/stl_iterator.h:32, from c++/14.0.0/bits/stl_iterator.h:3004, from c++/14.0.0/bits/stl_algobase.h:67, from c++/14.0.0/algorithm:60, from <source>:2: <source>:7:21: in 'constexpr' expansion of 'f(std::__cxx11::basic_string<char>(((const char*)"aa"), std::allocator<char>()), std::__cxx11::basic_string<char>(((const char*)"aa"), std::allocator<char>()))' <source>:5:22: in 'constexpr' expansion of 'std::equal<const char*, const char*>((& l)->std::__cxx11::basic_string<char>::data(), ((& l)->std::__cxx11::basic_string<char>::data() + ((sizetype)(& l)->std::__cxx11::basic_string<char>::size())), (& r)->std::__cxx11::basic_string<char>::data(), ((& r)->std::__cxx11::basic_string<char>::data() + ((sizetype)(& r)->std::__cxx11::basic_string<char>::size())))' c++/14.0.0/bits/stl_algobase.h:1679:7: in 'constexpr' expansion of '__gnu_debug::__valid_range<const char*>(__first1, __last1)' c++/14.0.0/debug/helper_functions.h:257:31: in 'constexpr' expansion of '__gnu_debug::__valid_range_aux<const char*>(__first, __last, (_Integral(), _Integral()))' c++/14.0.0/debug/helper_functions.h:189:31: in 'constexpr' expansion of '__gnu_debug::__valid_range_aux<const char*>(__first, __last, (std::__iterator_category<const char*>(__first), std::iterator_traits<const char*>::iterator_category()))' c++/14.0.0/debug/helper_functions.h:176:19: in 'constexpr' expansion of '__gnu_debug::__valid_range_aux<const char*>(__first, __last, (std::input_iterator_tag(), std::input_iterator_tag()))' c++/14.0.0/debug/helper_functions.h:136:20: error: '(((const char*)(&<anonymous>.std::__cxx11::basic_string<char>::<anonymous>.std::__cxx11::basic_string<char>::<unnamed union>::_M_local_buf)) == 0)' is not a constant expression 136 | { return __ptr == 0; } | ~~~~~~^~~~ This appears to be caused by bug 109975, but I'm filing separately since it may be possible to fix in library. The code is accepted if _GLIBCXX_DEBUG is not defined, since __gnu_debug::__valid_range is not checked.
next reply other threads:[~2023-05-26 3:25 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-05-26 3:25 ed at catmur dot uk [this message] 2023-05-26 3:28 ` [Bug libstdc++/109976] " pinskia at gcc dot gnu.org 2023-05-26 8:20 ` redi at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-109976-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).