public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/107894] [feature request] _GLIBCXX_ASSERTIONS for std::optional Date: Mon, 28 Nov 2022 11:08:15 +0000 [thread overview] Message-ID: <bug-107894-4-1tNeFQRSWC@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-107894-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107894 Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |DUPLICATE --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to tim blechmann from comment #0) > `_GLIBCXX_ASSERTIONS` does not enable any API validation for std::optional. I don't know why people keep claiming this, but it's nonsense. tmp$ cat opt.cc #include <optional> int main() { std::optional<int> o; return *o.operator->(); } tmp$ g++ -D_GLIBCXX_ASSERTIONS opt.cc tmp$ ./a.out /usr/include/c++/12/optional:477: constexpr _Tp& std::_Optional_base_impl<_Tp, _Dp>::_M_get() [with _Tp = int; _Dp = std::_Optional_base<int, true, true>]: Assertion 'this->_M_is_engaged()' failed. Aborted (core dumped) > it would be great if libstdc++ could perform the same validation It already does, please try it instead of just skimming the code. *** This bug has been marked as a duplicate of bug 102712 ***
prev parent reply other threads:[~2022-11-28 11:08 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-11-28 10:27 [Bug libstdc++/107894] New: " tim at klingt dot org 2022-11-28 11:08 ` redi at gcc dot gnu.org [this message]
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-107894-4-1tNeFQRSWC@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).