===================================================================
@@ -5675,7 +5675,8 @@ cp_build_unary_op (enum tree_code code, tree xarg,
break;
case TRUTH_NOT_EXPR:
- arg = perform_implicit_conversion (boolean_type_node, arg,
+ arg = perform_implicit_conversion (boolean_type_node,
+ decay_conversion (arg, complain),
complain);
val = invert_truthvalue_loc (input_location, arg);
if (arg != error_mark_node)
===================================================================
@@ -0,0 +1,4 @@
+// PR c++/50961
+
+template < class > void foo ();
+bool b = !foo<void>;