This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/50660] warning about pass NULL to non pointer argument happens twice for template function call
- From: "paolo.carlini at oracle dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 07 Oct 2011 19:32:03 +0000
- Subject: [Bug c++/50660] warning about pass NULL to non pointer argument happens twice for template function call
- Auto-submitted: auto-generated
- References: <bug-50660-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50660
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-10-07 19:32:03 UTC ---
Something like this handles correctly the testcase and passes the testsuite,
but at the moment I don't know if we could do something else. Maybe Jason can
have a quick look...
Index: call.c
===================================================================
--- call.c (revision 179660)
+++ call.c (working copy)
@@ -5559,6 +5559,7 @@ convert_like_real (conversion *convs, tree expr, t
tree totype = convs->type;
diagnostic_t diag_kind;
int flags;
+ int savew = warningcount;
if (convs->bad_p && !(complain & tf_error))
return error_mark_node;
@@ -5783,7 +5784,9 @@ convert_like_real (conversion *convs, tree expr, t
expr = convert_like_real (convs->u.next, expr, fn, argnum,
convs->kind == ck_ref_bind ? -1 : 1,
- convs->kind == ck_ref_bind ? issue_conversion_warnings :
false,
+ convs->kind == ck_ref_bind
+ && warningcount == savew
+ ? issue_conversion_warnings : false,
c_cast_p,
complain);
if (expr == error_mark_node)