diff mbox

[C++] PR c++/35878

Message ID CAFk2RUa7972Ob+jkO9OKeXixyFsokgmTa9BBWubWwM26Z6bj+A@mail.gmail.com
State New
Headers show

Commit Message

Ville Voutilainen March 21, 2017, 12:46 a.m. UTC
On 21 March 2017 at 02:43, Ville Voutilainen
<ville.voutilainen@gmail.com> wrote:
> Hmm. I should either rename that function or flip its logic. Now it's
> a bit backwards. :) I'll flip its logic.

In other words, see attached.
diff mbox

Patch

diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index dc5a5f7..a6be32e 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -2703,9 +2703,9 @@  static bool non_allocating_fn_p (tree alloc_fn)
       tree first_arg = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (alloc_fn)));
       if ((TREE_VALUE (first_arg) == ptr_type_node)
 	  && TREE_CHAIN (first_arg) == void_list_node)
-	return false;
+	return true;
     }
-  return true;
+  return false;
 }
 
 /* Generate code for a new-expression, including calling the "operator
@@ -3187,7 +3187,7 @@  build_new_1 (vec<tree, va_gc> **placement, tree type, tree nelts,
 
   nothrow = TYPE_NOTHROW_P (TREE_TYPE (alloc_fn));
   check_new = flag_check_new
-    || (nothrow && non_allocating_fn_p (alloc_fn));
+    || (nothrow && !non_allocating_fn_p (alloc_fn));
 
   if (cookie_size)
     {