[C++ Patch/RFC] PR 50961
Paolo Carlini
paolo.carlini@oracle.com
Tue Jul 15 21:20:00 GMT 2014
Hi,
I have another half-baked issue about which I'd like to have some
guidance... In this case too at least the draft patch works and passes
the testsuite.
Essentially, something seems missing in the way we handle operator!
applied to a TEMPLATE_ID_EXPR, whereas the non-template version already
works: using perform_implicit_conversion alone leads to "cannot resolve
overloaded function ‘foo’ based on conversion to type ‘bool’". I'm not
sure however that a decay_conversion is in general correct...
Thanks!
Paolo.
//////////////////
-------------- next part --------------
Index: cp/typeck.c
===================================================================
--- cp/typeck.c (revision 212559)
+++ cp/typeck.c (working copy)
@@ -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)
Index: testsuite/g++.dg/template/operator13.C
===================================================================
--- testsuite/g++.dg/template/operator13.C (revision 0)
+++ testsuite/g++.dg/template/operator13.C (working copy)
@@ -0,0 +1,4 @@
+// PR c++/50961
+
+template < class > void foo ();
+bool b = !foo<void>;
More information about the Gcc-patches
mailing list