public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101659] New: _GLIBCXX_DEBUG mode for std::optional ?
@ 2021-07-28 20:55 simon.marchi at polymtl dot ca
  2021-07-29  6:21 ` [Bug libstdc++/101659] " rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: simon.marchi at polymtl dot ca @ 2021-07-28 20:55 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101659
           Summary: _GLIBCXX_DEBUG mode for std::optional ?
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: simon.marchi at polymtl dot ca
  Target Milestone: ---

There doesn't seem to be a version of std::optional with debug runtime checks
enabled with _GLIBCXX_DEBUG.  It seems to me like it would be useful, to catch
"dereferencing" the optional when it doesn't contain a value.

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

* [Bug libstdc++/101659] _GLIBCXX_DEBUG mode for std::optional ?
  2021-07-28 20:55 [Bug c++/101659] New: _GLIBCXX_DEBUG mode for std::optional ? simon.marchi at polymtl dot ca
@ 2021-07-29  6:21 ` rguenth at gcc dot gnu.org
  2021-07-29  9:16 ` glisse at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-07-29  6:21 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unknown                     |12.0
           Severity|normal                      |enhancement

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

* [Bug libstdc++/101659] _GLIBCXX_DEBUG mode for std::optional ?
  2021-07-28 20:55 [Bug c++/101659] New: _GLIBCXX_DEBUG mode for std::optional ? simon.marchi at polymtl dot ca
  2021-07-29  6:21 ` [Bug libstdc++/101659] " rguenth at gcc dot gnu.org
@ 2021-07-29  9:16 ` glisse at gcc dot gnu.org
  2021-07-29 12:08 ` simon.marchi at polymtl dot ca
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: glisse at gcc dot gnu.org @ 2021-07-29  9:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> ---
I already see some "__glibcxx_assert(this->_M_is_engaged());" in the code,
which IIUC should be enabled by _GLIBCXX_ASSERTIONS (and a fortiori by
_GLIBCXX_DEBUG). Did you actually try it?

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

* [Bug libstdc++/101659] _GLIBCXX_DEBUG mode for std::optional ?
  2021-07-28 20:55 [Bug c++/101659] New: _GLIBCXX_DEBUG mode for std::optional ? simon.marchi at polymtl dot ca
  2021-07-29  6:21 ` [Bug libstdc++/101659] " rguenth at gcc dot gnu.org
  2021-07-29  9:16 ` glisse at gcc dot gnu.org
@ 2021-07-29 12:08 ` simon.marchi at polymtl dot ca
  2021-07-29 12:12 ` redi at gcc dot gnu.org
  2021-07-29 12:13 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: simon.marchi at polymtl dot ca @ 2021-07-29 12:08 UTC (permalink / raw)
  To: gcc-bugs

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

Simon Marchi <simon.marchi at polymtl dot ca> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from Simon Marchi <simon.marchi at polymtl dot ca> ---
(In reply to Marc Glisse from comment #1)
> I already see some "__glibcxx_assert(this->_M_is_engaged());" in the code,
> which IIUC should be enabled by _GLIBCXX_ASSERTIONS (and a fortiori by
> _GLIBCXX_DEBUG). Did you actually try it?

Arf, yes I did try it.  But I now see that I compiled my test.cpp _without_
_GLIBCXX_DEBUG (with the intention of compiling with it).  Now that I did it
correctly, I see the assertion triggers.

Thanks, and sorry for wasting everyone's time.

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

* [Bug libstdc++/101659] _GLIBCXX_DEBUG mode for std::optional ?
  2021-07-28 20:55 [Bug c++/101659] New: _GLIBCXX_DEBUG mode for std::optional ? simon.marchi at polymtl dot ca
                   ` (2 preceding siblings ...)
  2021-07-29 12:08 ` simon.marchi at polymtl dot ca
@ 2021-07-29 12:12 ` redi at gcc dot gnu.org
  2021-07-29 12:13 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2021-07-29 12:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Indeed. Marc added them in r8-711.

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

* [Bug libstdc++/101659] _GLIBCXX_DEBUG mode for std::optional ?
  2021-07-28 20:55 [Bug c++/101659] New: _GLIBCXX_DEBUG mode for std::optional ? simon.marchi at polymtl dot ca
                   ` (3 preceding siblings ...)
  2021-07-29 12:12 ` redi at gcc dot gnu.org
@ 2021-07-29 12:13 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2021-07-29 12:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
It might be nice to add them to std::experimental::optional too though.

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

end of thread, other threads:[~2021-07-29 12:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-28 20:55 [Bug c++/101659] New: _GLIBCXX_DEBUG mode for std::optional ? simon.marchi at polymtl dot ca
2021-07-29  6:21 ` [Bug libstdc++/101659] " rguenth at gcc dot gnu.org
2021-07-29  9:16 ` glisse at gcc dot gnu.org
2021-07-29 12:08 ` simon.marchi at polymtl dot ca
2021-07-29 12:12 ` redi at gcc dot gnu.org
2021-07-29 12:13 ` redi 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).