This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/14493] No std::bad_alloc::what() const
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Mar 2004 23:15:05 -0000
- Subject: [Bug libstdc++/14493] No std::bad_alloc::what() const
- References: <20040308221042.14493.debian-gcc@lists.debian.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From bangerth at dealii dot org 2004-03-08 23:15 -------
For Andrew: the code takes the respective method of the base
class.
Here's a testcase:
---------------
#include <iostream>
#include <new>
int main ()
{
try
{
new char[static_cast<unsigned int>(-1)/2];
}
catch (std::exception &e)
{
std::cerr << e.what () << std::endl;
}
}
----------------------
g/x> icc x.cc
g/x> ./a.out
bad allocation
g/x>
g/x> /home/bangerth/bin/gcc-3.5-pre/bin/c++ x.cc
g/x> ./a.out
St9bad_alloc
I believe that libstdc++ is actually conforming, since the method exists
(even if in the base class) and it returns an implementation defined
string (as required by the standard). Some of the libstdc++ folks should
comment on this.
W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14493