public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/14493] std::bad_alloc::what() does not explain what happened
       [not found] <bug-14493-4@http.gcc.gnu.org/bugzilla/>
@ 2023-04-04 11:17 ` cvs-commit at gcc dot gnu.org
  2023-04-20 13:57 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 20+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-04 11:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #30 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:688d126b69215db29774c249b052e52d765782b3

commit r13-6999-g688d126b69215db29774c249b052e52d765782b3
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Apr 4 12:04:14 2023 +0100

    libstdc++: Fix outdated docs about demangling exception messages

    The string returned by std::bad_exception::what() hasn't been a mangled
    name since PR libstdc++/14493 was fixed for GCC 4.2.0, so remove the
    docs showing how to demangle it.

    libstdc++-v3/ChangeLog:

            * doc/xml/manual/extensions.xml: Remove std::bad_exception from
            example program.
            * doc/html/manual/ext_demangling.html: Regenerate.

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

* [Bug libstdc++/14493] std::bad_alloc::what() does not explain what happened
       [not found] <bug-14493-4@http.gcc.gnu.org/bugzilla/>
  2023-04-04 11:17 ` [Bug libstdc++/14493] std::bad_alloc::what() does not explain what happened cvs-commit at gcc dot gnu.org
@ 2023-04-20 13:57 ` cvs-commit at gcc dot gnu.org
  2023-04-27 22:01 ` cvs-commit at gcc dot gnu.org
  2023-04-27 23:04 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 20+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-20 13:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #31 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:e016a6ddbf0038056b9d8f2bc0bad350ff026632

commit r12-9456-ge016a6ddbf0038056b9d8f2bc0bad350ff026632
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Apr 4 12:04:14 2023 +0100

    libstdc++: Fix outdated docs about demangling exception messages

    The string returned by std::bad_exception::what() hasn't been a mangled
    name since PR libstdc++/14493 was fixed for GCC 4.2.0, so remove the
    docs showing how to demangle it.

    libstdc++-v3/ChangeLog:

            * doc/xml/manual/extensions.xml: Remove std::bad_exception from
            example program.
            * doc/html/manual/ext_demangling.html: Regenerate.

    (cherry picked from commit 688d126b69215db29774c249b052e52d765782b3)

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

* [Bug libstdc++/14493] std::bad_alloc::what() does not explain what happened
       [not found] <bug-14493-4@http.gcc.gnu.org/bugzilla/>
  2023-04-04 11:17 ` [Bug libstdc++/14493] std::bad_alloc::what() does not explain what happened cvs-commit at gcc dot gnu.org
  2023-04-20 13:57 ` cvs-commit at gcc dot gnu.org
@ 2023-04-27 22:01 ` cvs-commit at gcc dot gnu.org
  2023-04-27 23:04 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 20+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-27 22:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #32 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:ee1a8294754af16b00538b17414679c8d72a575b

commit r11-10660-gee1a8294754af16b00538b17414679c8d72a575b
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Apr 4 12:04:14 2023 +0100

    libstdc++: Fix outdated docs about demangling exception messages

    The string returned by std::bad_exception::what() hasn't been a mangled
    name since PR libstdc++/14493 was fixed for GCC 4.2.0, so remove the
    docs showing how to demangle it.

    libstdc++-v3/ChangeLog:

            * doc/xml/manual/extensions.xml: Remove std::bad_exception from
            example program.
            * doc/html/manual/ext_demangling.html: Regenerate.

    (cherry picked from commit 688d126b69215db29774c249b052e52d765782b3)

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

* [Bug libstdc++/14493] std::bad_alloc::what() does not explain what happened
       [not found] <bug-14493-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2023-04-27 22:01 ` cvs-commit at gcc dot gnu.org
@ 2023-04-27 23:04 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 20+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-27 23:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #33 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:c73f20e67ee8d268bf0dfd6732c1bd3e79e098ca

commit r10-11323-gc73f20e67ee8d268bf0dfd6732c1bd3e79e098ca
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Apr 4 12:04:14 2023 +0100

    libstdc++: Fix outdated docs about demangling exception messages

    The string returned by std::bad_exception::what() hasn't been a mangled
    name since PR libstdc++/14493 was fixed for GCC 4.2.0, so remove the
    docs showing how to demangle it.

    libstdc++-v3/ChangeLog:

            * doc/xml/manual/extensions.xml: Remove std::bad_exception from
            example program.
            * doc/html/manual/ext_demangling.html: Regenerate.

    (cherry picked from commit 688d126b69215db29774c249b052e52d765782b3)

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

* [Bug libstdc++/14493] std::bad_alloc::what() does not explain what happened
       [not found] <bug-14493-5724@http.gcc.gnu.org/bugzilla/>
                   ` (11 preceding siblings ...)
  2007-02-01 15:57 ` paolo at gcc dot gnu dot org
@ 2007-02-01 15:58 ` pcarlini at suse dot de
  12 siblings, 0 replies; 20+ messages in thread
From: pcarlini at suse dot de @ 2007-02-01 15:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #29 from pcarlini at suse dot de  2007-02-01 15:58 -------
Fixed.


-- 

pcarlini at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14493


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

* [Bug libstdc++/14493] std::bad_alloc::what() does not explain what happened
       [not found] <bug-14493-5724@http.gcc.gnu.org/bugzilla/>
                   ` (10 preceding siblings ...)
  2007-02-01 13:39 ` pcarlini at suse dot de
@ 2007-02-01 15:57 ` paolo at gcc dot gnu dot org
  2007-02-01 15:58 ` pcarlini at suse dot de
  12 siblings, 0 replies; 20+ messages in thread
From: paolo at gcc dot gnu dot org @ 2007-02-01 15:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #28 from paolo at gcc dot gnu dot org  2007-02-01 15:56 -------
Subject: Bug 14493

Author: paolo
Date: Thu Feb  1 15:56:37 2007
New Revision: 121465

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=121465
Log:
2007-02-01  Paolo Carlini  <pcarlini@suse.de>

        PR libstdc++/14493
        * libsupc++/typeinfo (bad_cast::what, bad_typeid::what): Declare.
        * libsupc++/tinfo.cc: Define.   
        * libsupc++/exception (bad_exception::what): Declare.
        * libsupc++/eh_exception.cc: Define.
        (exception::what): Adjust, don't use typeid.
        * libsupc++/new (bad_alloc::what): Declare.
        * libsupc++/new_handler.cc: Define.
        * config/abi/pre/gnu.ver: Export the new methods @3.4.9.
        * testsuite/18_support/14493.cc: New.

2007-02-01  Paolo Carlini  <pcarlini@suse.de>

        PR libstdc++/29496
        * include/debug/safe_base.h (_Safe_sequence_base::_M_get_mutex,
        _Safe_iterator_base::_M_get_mutex, _M_attach_single, _M_detach_single):
        New.
        * src/debug.cc: Define the latter.
        (_Safe_sequence_base::_M_detach_all, _M_detach_singular,
        _M_revalidate_singular, _M_swap): Use the mutex.
        (_Safe_iterator_base::_M_attach, _M_detach): Adjust, forward to the
        *_single version.
        * include/debug/safe_iterator.h (_Safe_iterator<>::_M_attach_single,
        _M_invalidate_single): New.
        * include/debug/safe_iterator.tcc: Define.
        (_Safe_iterator<>::_M_invalidate): Adjust, forward to
        _M_invalidate_single.
        * include/debug/safe_sequence.h (_Safe_sequence<>::_M_invalidate_if,
        _M_transfer_iter): Use the mutex, adjust, forward to the *_single
        versions of _M_invalidate and _M_attach.
        * config/abi/pre/gnu.ver (_Safe_sequence_base::_M_get_mutex,
        _Safe_iterator_base::_M_get_mutex, _M_attach_single, _M_detach_single):
        Add @GLIBCXX_3.4.9; adjust.

Added:
    branches/gcc-4_2-branch/libstdc++-v3/testsuite/18_support/14493.cc
Modified:
    branches/gcc-4_2-branch/libstdc++-v3/ChangeLog
    branches/gcc-4_2-branch/libstdc++-v3/config/abi/pre/gnu.ver
    branches/gcc-4_2-branch/libstdc++-v3/include/debug/safe_base.h
    branches/gcc-4_2-branch/libstdc++-v3/include/debug/safe_iterator.h
    branches/gcc-4_2-branch/libstdc++-v3/include/debug/safe_iterator.tcc
    branches/gcc-4_2-branch/libstdc++-v3/include/debug/safe_sequence.h
    branches/gcc-4_2-branch/libstdc++-v3/libsupc++/eh_exception.cc
    branches/gcc-4_2-branch/libstdc++-v3/libsupc++/exception
    branches/gcc-4_2-branch/libstdc++-v3/libsupc++/new
    branches/gcc-4_2-branch/libstdc++-v3/libsupc++/new_handler.cc
    branches/gcc-4_2-branch/libstdc++-v3/libsupc++/tinfo.cc
    branches/gcc-4_2-branch/libstdc++-v3/libsupc++/typeinfo
    branches/gcc-4_2-branch/libstdc++-v3/src/debug.cc


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14493


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

* [Bug libstdc++/14493] std::bad_alloc::what() does not explain what happened
       [not found] <bug-14493-5724@http.gcc.gnu.org/bugzilla/>
                   ` (9 preceding siblings ...)
  2007-02-01 13:37 ` paolo at gcc dot gnu dot org
@ 2007-02-01 13:39 ` pcarlini at suse dot de
  2007-02-01 15:57 ` paolo at gcc dot gnu dot org
  2007-02-01 15:58 ` pcarlini at suse dot de
  12 siblings, 0 replies; 20+ messages in thread
From: pcarlini at suse dot de @ 2007-02-01 13:39 UTC (permalink / raw)
  To: gcc-bugs



-- 

pcarlini at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.2.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14493


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

* [Bug libstdc++/14493] std::bad_alloc::what() does not explain what happened
       [not found] <bug-14493-5724@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2007-02-01  2:18 ` lopresti at gmail dot com
@ 2007-02-01 13:37 ` paolo at gcc dot gnu dot org
  2007-02-01 13:39 ` pcarlini at suse dot de
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 20+ messages in thread
From: paolo at gcc dot gnu dot org @ 2007-02-01 13:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #27 from paolo at gcc dot gnu dot org  2007-02-01 13:37 -------
Subject: Bug 14493

Author: paolo
Date: Thu Feb  1 13:36:51 2007
New Revision: 121461

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=121461
Log:
2007-02-01  Paolo Carlini  <pcarlini@suse.de>

        PR libstdc++/14493
        * libsupc++/typeinfo (bad_cast::what, bad_typeid::what): Declare.
        * libsupc++/tinfo.cc: Define.   
        * libsupc++/exception (bad_exception::what): Declare.
        * libsupc++/eh_exception.cc: Define.
        (exception::what): Adjust, don't use typeid.
        * libsupc++/new (bad_alloc::what): Declare.
        * libsupc++/new_handler.cc: Define.
        * config/abi/pre/gnu.ver: Export the new methods @3.4.9; adjust
        existing 3.4.10 exports to 3.4.9.
        * configure.ac: Adjust to 6.0.9.
        * configure: Regenerate.
        * testsuite/util/testsuite_abi.cc: Update.
        * testsuite/18_support/14493.cc: New.

Added:
    trunk/libstdc++-v3/testsuite/18_support/14493.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/config/abi/pre/gnu.ver
    trunk/libstdc++-v3/configure
    trunk/libstdc++-v3/configure.ac
    trunk/libstdc++-v3/libsupc++/eh_exception.cc
    trunk/libstdc++-v3/libsupc++/exception
    trunk/libstdc++-v3/libsupc++/new
    trunk/libstdc++-v3/libsupc++/new_handler.cc
    trunk/libstdc++-v3/libsupc++/tinfo.cc
    trunk/libstdc++-v3/libsupc++/typeinfo
    trunk/libstdc++-v3/testsuite/util/testsuite_abi.cc


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14493


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

* [Bug libstdc++/14493] std::bad_alloc::what() does not explain what happened
       [not found] <bug-14493-5724@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2007-01-30  3:53 ` gdr at cs dot tamu dot edu
@ 2007-02-01  2:18 ` lopresti at gmail dot com
  2007-02-01 13:37 ` paolo at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 20+ messages in thread
From: lopresti at gmail dot com @ 2007-02-01  2:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #26 from lopresti at gmail dot com  2007-02-01 02:17 -------
I found this PR because I tried calling what() on a bad_alloc, was surprised by
what I got, and did a search.  This is my perspective as a random end user;
make of it what you will.

I think "std::bad_alloc" is an improvement.  But I was actually expecting
what() to provide something human readable and very specific, like "out of
memory" or "heap corrupted".  In my case, I already know the exception is a
std::bad_alloc; I could generate that particular constant string myself...

I find it remarkable that this PR is almost two years old.


-- 

lopresti at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lopresti at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14493


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

* [Bug libstdc++/14493] std::bad_alloc::what() does not explain what happened
       [not found] <bug-14493-5724@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2007-01-30  2:21 ` pcarlini at suse dot de
@ 2007-01-30  3:53 ` gdr at cs dot tamu dot edu
  2007-02-01  2:18 ` lopresti at gmail dot com
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 20+ messages in thread
From: gdr at cs dot tamu dot edu @ 2007-01-30  3:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #25 from gdr at cs dot tamu dot edu  2007-01-30 03:53 -------
Subject: Re:  std::bad_alloc::what() does not explain what happened

"pcarlini at suse dot de" <gcc-bugzilla@gcc.gnu.org> writes:

| > However, the use of typeid is very convenient in the sense that we
| > have to defined what() only once.  Now, if we change that definition
| > in std::exception, it means that we should revisit all other exception
| > classes, such as std::runtime_error, etc.
| 
| I see, but I don't think we have to do much, because the other exception
| classes, provided in <stdexcept>, per the standard requirements are already
| overriding what() to return _M_msg.c_str(). Thus, I'm coming to the
conclusion
| that we should consistently change std::exception too and be done with it.

You're right.  I agree with your analysis.

-- Gaby


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14493


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

* [Bug libstdc++/14493] std::bad_alloc::what() does not explain what happened
       [not found] <bug-14493-5724@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2007-01-30  2:11 ` gdr at cs dot tamu dot edu
@ 2007-01-30  2:21 ` pcarlini at suse dot de
  2007-01-30  3:53 ` gdr at cs dot tamu dot edu
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 20+ messages in thread
From: pcarlini at suse dot de @ 2007-01-30  2:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #24 from pcarlini at suse dot de  2007-01-30 02:21 -------
(In reply to comment #23)
> From consistency point of view I would say that the change should also
> be done for std::exception.  

Right.

> However, the use of typeid is very convenient in the sense that we
> have to defined what() only once.  Now, if we change that definition
> in std::exception, it means that we should revisit all other exception
> classes, such as std::runtime_error, etc.

I see, but I don't think we have to do much, because the other exception
classes, provided in <stdexcept>, per the standard requirements are already
overriding what() to return _M_msg.c_str(). Thus, I'm coming to the conclusion
that we should consistently change std::exception too and be done with it.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14493


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

* [Bug libstdc++/14493] std::bad_alloc::what() does not explain what happened
       [not found] <bug-14493-5724@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2007-01-30  1:42 ` pcarlini at suse dot de
@ 2007-01-30  2:11 ` gdr at cs dot tamu dot edu
  2007-01-30  2:21 ` pcarlini at suse dot de
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 20+ messages in thread
From: gdr at cs dot tamu dot edu @ 2007-01-30  2:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #23 from gdr at cs dot tamu dot edu  2007-01-30 02:11 -------
Subject: Re:  std::bad_alloc::what() does not explain what happened

"pcarlini at suse dot de" <gcc-bugzilla@gcc.gnu.org> writes:

| ------- Comment #22 from pcarlini at suse dot de  2007-01-30 01:42 -------
| (In reply to comment #21)
| > I suspect Andrew Pinski's point might be that what() could return a
| > string that represents the name of the most derived type of the
| > exception.  But, nothing so far forces to do that.  A reasonable
| > definition is to what Paolo suggest, with clear documentation (that
| > mentions this).
| 
| Agreed. Gaby, do you have any strong opinion about std::exception
| itself? In my current patch draft I'm leaving it alone, but in
| principle we could change also its what() to return "std::exception"
| instead of typeid(*this).name(). 

>From consistency point of view I would say that the change should also
be done for std::exception.  

However, the use of typeid is very convenient in the sense that we
have to defined what() only once.  Now, if we change that definition
in std::exception, it means that we should revisit all other exception
classes, such as std::runtime_error, etc.

I have no strong opinion.  Probably just leave it as is, and document
the choices we face so that people see the rationale behind the
implementations.

Thanks,

-- Gaby


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14493


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

* [Bug libstdc++/14493] std::bad_alloc::what() does not explain what happened
       [not found] <bug-14493-5724@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2007-01-30  1:30 ` gdr at cs dot tamu dot edu
@ 2007-01-30  1:42 ` pcarlini at suse dot de
  2007-01-30  2:11 ` gdr at cs dot tamu dot edu
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 20+ messages in thread
From: pcarlini at suse dot de @ 2007-01-30  1:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #22 from pcarlini at suse dot de  2007-01-30 01:42 -------
(In reply to comment #21)
> I suspect Andrew Pinski's point might be that what() could return a
> string that represents the name of the most derived type of the
> exception.  But, nothing so far forces to do that.  A reasonable
> definition is to what Paolo suggest, with clear documentation (that
> mentions this).

Agreed. Gaby, do you have any strong opinion about std::exception itself? In my
current patch draft I'm leaving it alone, but in principle we could change also
its what() to return "std::exception" instead of typeid(*this).name(). In other
terms, I'm not sure whether your Comment #13 contrary to the mangled typeid
applies also to the base std::exception...


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14493


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

* [Bug libstdc++/14493] std::bad_alloc::what() does not explain what happened
       [not found] <bug-14493-5724@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2007-01-30  0:58 ` pcarlini at suse dot de
@ 2007-01-30  1:30 ` gdr at cs dot tamu dot edu
  2007-01-30  1:42 ` pcarlini at suse dot de
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 20+ messages in thread
From: gdr at cs dot tamu dot edu @ 2007-01-30  1:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #21 from gdr at cs dot tamu dot edu  2007-01-30 01:30 -------
Subject: Re:  std::bad_alloc::what() does not explain what happened

"pcarlini at suse dot de" <gcc-bugzilla@gcc.gnu.org> writes:

| What do you mean by "incorrect"?!? If you subclass, either you
| provide your own what(), or you get the what() provided by the base
| class, which is implementation defined and, very reasonably,
| "std::bad_cast" for class bad_cast, and so on... 

Paolo is technically right: what() is a virtual member function; so
one should not derive from those classes and except that what()
returned something they did not define or we did not promise.

I suspect Andrew Pinski's point might be that what() could return a
string that represents the name of the most derived type of the
exception.  But, nothing so far forces to do that.  A reasonable
definition is to what Paolo suggest, with clear documentation (that
mentions this). 

-- Gaby


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14493


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

* [Bug libstdc++/14493] std::bad_alloc::what() does not explain what happened
       [not found] <bug-14493-5724@http.gcc.gnu.org/bugzilla/>
  2007-01-30  0:34 ` pcarlini at suse dot de
  2007-01-30  0:54 ` pinskia at gcc dot gnu dot org
@ 2007-01-30  0:58 ` pcarlini at suse dot de
  2007-01-30  1:30 ` gdr at cs dot tamu dot edu
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 20+ messages in thread
From: pcarlini at suse dot de @ 2007-01-30  0:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #20 from pcarlini at suse dot de  2007-01-30 00:58 -------
(In reply to comment #19)
> I don't think that is the correct solution as if you subclass these functions,
> you get the incorrect result.

What do you mean by "incorrect"?!? If you subclass, either you provide your own
what(), or you get the what() provided by the base class, which is
implementation defined and, very reasonably, "std::bad_cast" for class
bad_cast, and so on... 


-- 

pcarlini at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gdr at integrable-solutions
                   |                            |dot net


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14493


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

* [Bug libstdc++/14493] std::bad_alloc::what() does not explain what happened
       [not found] <bug-14493-5724@http.gcc.gnu.org/bugzilla/>
  2007-01-30  0:34 ` pcarlini at suse dot de
@ 2007-01-30  0:54 ` pinskia at gcc dot gnu dot org
  2007-01-30  0:58 ` pcarlini at suse dot de
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 20+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-01-30  0:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #19 from pinskia at gcc dot gnu dot org  2007-01-30 00:54 -------
(In reply to comment #18)
> Implementing the really trivial solution of providing what() members returning
> "std::bad_alloc", "std::bad_cast", "std::bad_typeid", and "std::bad_exception".
I don't think that is the correct solution as if you subclass these functions,
you get the incorrect result.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14493


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

* [Bug libstdc++/14493] std::bad_alloc::what() does not explain what happened
       [not found] <bug-14493-5724@http.gcc.gnu.org/bugzilla/>
@ 2007-01-30  0:34 ` pcarlini at suse dot de
  2007-01-30  0:54 ` pinskia at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 20+ messages in thread
From: pcarlini at suse dot de @ 2007-01-30  0:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #18 from pcarlini at suse dot de  2007-01-30 00:34 -------
Implementing the really trivial solution of providing what() members returning
"std::bad_alloc", "std::bad_cast", "std::bad_typeid", and "std::bad_exception".


-- 

pcarlini at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pcarlini at suse dot de
                   |dot org                     |
             Status|NEW                         |ASSIGNED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14493


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

* [Bug libstdc++/14493] std::bad_alloc::what() does not explain what happened
  2004-03-08 22:10 [Bug libstdc++/14493] New: new: No std::bad_alloc::what() const debian-gcc at lists dot debian dot org
  2004-04-27 13:54 ` [Bug libstdc++/14493] std::bad_alloc::what() does not explain what happened pinskia at gcc dot gnu dot org
  2004-08-05 14:37 ` pcarlini at suse dot de
@ 2004-08-05 15:01 ` pcarlini at suse dot de
  2 siblings, 0 replies; 20+ messages in thread
From: pcarlini at suse dot de @ 2004-08-05 15:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pcarlini at suse dot de  2004-08-05 15:00 -------
... actually, not so trivial, because of the need to free the memory allocated
by __cxa_demangle :(
By the way, current Icc doesn't demangle anymore.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|pcarlini at suse dot de     |unassigned at gcc dot gnu
                   |                            |dot org
             Status|ASSIGNED                    |NEW


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14493


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

* [Bug libstdc++/14493] std::bad_alloc::what() does not explain what happened
  2004-03-08 22:10 [Bug libstdc++/14493] New: new: No std::bad_alloc::what() const debian-gcc at lists dot debian dot org
  2004-04-27 13:54 ` [Bug libstdc++/14493] std::bad_alloc::what() does not explain what happened pinskia at gcc dot gnu dot org
@ 2004-08-05 14:37 ` pcarlini at suse dot de
  2004-08-05 15:01 ` pcarlini at suse dot de
  2 siblings, 0 replies; 20+ messages in thread
From: pcarlini at suse dot de @ 2004-08-05 14:37 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pcarlini at suse dot de  2004-08-05 14:37 -------
Implementing the trivial fix...

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pcarlini at suse dot de
                   |dot org                     |
             Status|NEW                         |ASSIGNED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14493


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

* [Bug libstdc++/14493] std::bad_alloc::what() does not explain what happened
  2004-03-08 22:10 [Bug libstdc++/14493] New: new: No std::bad_alloc::what() const debian-gcc at lists dot debian dot org
@ 2004-04-27 13:54 ` pinskia at gcc dot gnu dot org
  2004-08-05 14:37 ` pcarlini at suse dot de
  2004-08-05 15:01 ` pcarlini at suse dot de
  2 siblings, 0 replies; 20+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-27 13:54 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|minor                       |enhancement
             Status|REOPENED                    |NEW
            Summary|No std::bad_alloc::what()   |std::bad_alloc::what() does
                   |const                       |not explain what happened


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14493


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

end of thread, other threads:[~2023-04-27 23:04 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-14493-4@http.gcc.gnu.org/bugzilla/>
2023-04-04 11:17 ` [Bug libstdc++/14493] std::bad_alloc::what() does not explain what happened cvs-commit at gcc dot gnu.org
2023-04-20 13:57 ` cvs-commit at gcc dot gnu.org
2023-04-27 22:01 ` cvs-commit at gcc dot gnu.org
2023-04-27 23:04 ` cvs-commit at gcc dot gnu.org
     [not found] <bug-14493-5724@http.gcc.gnu.org/bugzilla/>
2007-01-30  0:34 ` pcarlini at suse dot de
2007-01-30  0:54 ` pinskia at gcc dot gnu dot org
2007-01-30  0:58 ` pcarlini at suse dot de
2007-01-30  1:30 ` gdr at cs dot tamu dot edu
2007-01-30  1:42 ` pcarlini at suse dot de
2007-01-30  2:11 ` gdr at cs dot tamu dot edu
2007-01-30  2:21 ` pcarlini at suse dot de
2007-01-30  3:53 ` gdr at cs dot tamu dot edu
2007-02-01  2:18 ` lopresti at gmail dot com
2007-02-01 13:37 ` paolo at gcc dot gnu dot org
2007-02-01 13:39 ` pcarlini at suse dot de
2007-02-01 15:57 ` paolo at gcc dot gnu dot org
2007-02-01 15:58 ` pcarlini at suse dot de
2004-03-08 22:10 [Bug libstdc++/14493] New: new: No std::bad_alloc::what() const debian-gcc at lists dot debian dot org
2004-04-27 13:54 ` [Bug libstdc++/14493] std::bad_alloc::what() does not explain what happened pinskia at gcc dot gnu dot org
2004-08-05 14:37 ` pcarlini at suse dot de
2004-08-05 15:01 ` pcarlini at suse dot de

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