xref: /netbsd-src/external/gpl3/gcc/dist/libstdc++-v3/libsupc++/bad_array_length.cc (revision b1e838363e3c6fc78a55519254d99869742dd33c)
1*b1e83836Smrg // Copyright (C) 2013-2022 Free Software Foundation, Inc.
24d5abbe8Smrg //
34d5abbe8Smrg // This file is part of GCC.
44d5abbe8Smrg //
54d5abbe8Smrg // GCC is free software; you can redistribute it and/or modify
64d5abbe8Smrg // it under the terms of the GNU General Public License as published by
74d5abbe8Smrg // the Free Software Foundation; either version 3, or (at your option)
84d5abbe8Smrg // any later version.
94d5abbe8Smrg 
104d5abbe8Smrg // GCC is distributed in the hope that it will be useful,
114d5abbe8Smrg // but WITHOUT ANY WARRANTY; without even the implied warranty of
124d5abbe8Smrg // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
134d5abbe8Smrg // GNU General Public License for more details.
144d5abbe8Smrg 
154d5abbe8Smrg // Under Section 7 of GPL version 3, you are granted additional
164d5abbe8Smrg // permissions described in the GCC Runtime Library Exception, version
174d5abbe8Smrg // 3.1, as published by the Free Software Foundation.
184d5abbe8Smrg 
194d5abbe8Smrg // You should have received a copy of the GNU General Public License and
204d5abbe8Smrg // a copy of the GCC Runtime Library Exception along with this program;
214d5abbe8Smrg // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
224d5abbe8Smrg // <http://www.gnu.org/licenses/>.
234d5abbe8Smrg 
244d5abbe8Smrg #include <new>
254d5abbe8Smrg 
264d5abbe8Smrg namespace std
274d5abbe8Smrg {
284d5abbe8Smrg // From N3639.  This was voted in and then back out of C++14, and is now
294d5abbe8Smrg // just here for backward link compatibility with code built with 4.9.
304d5abbe8Smrg class bad_array_length : public bad_alloc
314d5abbe8Smrg {
324d5abbe8Smrg public:
bad_array_length()334d5abbe8Smrg   bad_array_length() throw() { };
344d5abbe8Smrg 
354d5abbe8Smrg   // This declaration is not useless:
364d5abbe8Smrg   // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
374d5abbe8Smrg   virtual ~bad_array_length() throw();
384d5abbe8Smrg 
394d5abbe8Smrg   // See comment in eh_exception.cc.
404d5abbe8Smrg   virtual const char* what() const throw();
414d5abbe8Smrg };
424d5abbe8Smrg 
~bad_array_length()434d5abbe8Smrg bad_array_length::~bad_array_length() _GLIBCXX_USE_NOEXCEPT { }
444d5abbe8Smrg 
454d5abbe8Smrg const char*
what() const464d5abbe8Smrg bad_array_length::what() const _GLIBCXX_USE_NOEXCEPT
474d5abbe8Smrg { return "std::bad_array_length"; }
484d5abbe8Smrg 
494d5abbe8Smrg } // namespace std
504d5abbe8Smrg 
514d5abbe8Smrg namespace __cxxabiv1 {
524d5abbe8Smrg 
534d5abbe8Smrg extern "C" void
__cxa_throw_bad_array_length()544d5abbe8Smrg __cxa_throw_bad_array_length ()
554d5abbe8Smrg { _GLIBCXX_THROW_OR_ABORT(std::bad_array_length()); }
564d5abbe8Smrg 
574d5abbe8Smrg } // namespace __cxxabiv1
58