Pārlūkot izejas kodu

http://llvm.org/bugs/show_bug.cgi?id=10353

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135125 91177308-0d34-0410-b5e6-96231b3b80d8
Howard Hinnant 14 gadi atpakaļ
vecāks
revīzija
912012e949
1 mainītis faili ar 6 papildinājumiem un 0 dzēšanām
  1. 6 0
      src/new.cpp

+ 6 - 0
src/new.cpp

@@ -28,6 +28,9 @@
 __attribute__((__weak__, __visibility__("default")))
 __attribute__((__weak__, __visibility__("default")))
 void *
 void *
 operator new(std::size_t size)
 operator new(std::size_t size)
+#if !__has_feature(cxx_noexcept)
+    throw(std::bad_alloc)
+#endif
 {
 {
     if (size == 0)
     if (size == 0)
         size = 1;
         size = 1;
@@ -71,6 +74,9 @@ operator new(size_t size, const std::nothrow_t&) _NOEXCEPT
 __attribute__((__weak__, __visibility__("default")))
 __attribute__((__weak__, __visibility__("default")))
 void*
 void*
 operator new[](size_t size)
 operator new[](size_t size)
+#if !__has_feature(cxx_noexcept)
+    throw(std::bad_alloc)
+#endif
 {
 {
     return ::operator new(size);
     return ::operator new(size);
 }
 }