On 10/11/2011 01:46 AM, Jason Merrill wrote:
On 10/10/2011 12:44 AM, Paolo Carlini wrote:
If I just do this (I hope it's what you had in mind):
- tree t = non_reference (totype);
+ tree t = totype; /*non_reference (totype); */
variadic111.C:16:22: warning: converting ‘false’ to pointer type for
argument 3 of ‘void S<Args1>::f(Args1 ..., Args2&& ...) [with Args2 =
{bool, char}; Args1 = {int, double}]’ [-Wconversion-null]
Hmm, need to also change POINTER_TYPE_P to TYPE_PTR_P.
Great, this works (and I even learned something ;) Shall I commit it
when testing finishes?
Thanks,
Paolo.
///////////////////
2011-10-10 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/50660
* call.c (conversion_null_warnings): Don't look through references.
Index: call.c
===================================================================
--- call.c (revision 179765)
+++ call.c (working copy)
@@ -5514,10 +5514,9 @@
static void
conversion_null_warnings (tree totype, tree expr, tree fn, int argnum)
{
- tree t = non_reference (totype);
-
/* Issue warnings about peculiar, but valid, uses of NULL. */
- if (expr == null_node && TREE_CODE (t) != BOOLEAN_TYPE && ARITHMETIC_TYPE_P
(t))
+ if (expr == null_node && TREE_CODE (totype) != BOOLEAN_TYPE
+ && ARITHMETIC_TYPE_P (totype))
{
if (fn)
warning_at (input_location, OPT_Wconversion_null,
@@ -5525,11 +5524,11 @@
argnum, fn);
else
warning_at (input_location, OPT_Wconversion_null,
- "converting to non-pointer type %qT from NULL", t);
+ "converting to non-pointer type %qT from NULL", totype);
}
/* Issue warnings if "false" is converted to a NULL pointer */
- else if (expr == boolean_false_node && POINTER_TYPE_P (t))
+ else if (expr == boolean_false_node && TYPE_PTR_P (totype))
{
if (fn)
warning_at (input_location, OPT_Wconversion_null,
@@ -5537,7 +5536,7 @@
"of %qD", argnum, fn);
else
warning_at (input_location, OPT_Wconversion_null,
- "converting %<false%> to pointer type %qT", t);
+ "converting %<false%> to pointer type %qT", totype);
}
}