This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH: PR 13932
- From: Mark Mitchell <mark at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 4 Feb 2004 21:23:28 -0800
- Subject: C++ PATCH: PR 13932
- Reply-to: mark at codesourcery dot com
This patch eliminates a double-warning about a possible conversion
issue. The key observation is that dubious_conversion_warnings will
be called by convert_like_real, adn therefore not necessary in
convert_for_assignment. This problem was probably introduced when I
made more of the conversion code go through the standard overloading
machinery.
Tested on x86_64-suse-linux-gnu, applied on the mainline and on the
3.4 branch.
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
2004-02-04 Mark Mitchell <mark@codesourcery.com>
PR c++/13932
* call.c (convert_like_real): Use "converting" rather than
"argument" as the descriptive keyword to
dubious_conversion_warnings.
* typeck.c (convert_for_assignment): Do not call
dubious_conversion_warnings.
2004-02-04 Mark Mitchell <mark@codesourcery.com>
PR c++/13932
* g++.dg/warn/conv2.C: New test.
Index: call.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/call.c,v
retrieving revision 1.452.2.5
diff -c -5 -p -r1.452.2.5 call.c
*** call.c 2 Feb 2004 16:26:36 -0000 1.452.2.5
--- call.c 5 Feb 2004 05:13:49 -0000
*************** convert_like_real (tree convs, tree expr
*** 3898,3908 ****
return cp_convert (totype, expr);
}
if (issue_conversion_warnings)
expr = dubious_conversion_warnings
! (totype, expr, "argument", fn, argnum);
switch (TREE_CODE (convs))
{
case USER_CONV:
{
struct z_candidate *cand = USER_CONV_CAND (convs);
--- 3898,3908 ----
return cp_convert (totype, expr);
}
if (issue_conversion_warnings)
expr = dubious_conversion_warnings
! (totype, expr, "converting", fn, argnum);
switch (TREE_CODE (convs))
{
case USER_CONV:
{
struct z_candidate *cand = USER_CONV_CAND (convs);
Index: typeck.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/typeck.c,v
retrieving revision 1.519.2.4
diff -c -5 -p -r1.519.2.4 typeck.c
*** typeck.c 2 Feb 2004 16:26:45 -0000 1.519.2.4
--- typeck.c 5 Feb 2004 05:13:51 -0000
*************** convert_for_assignment (tree type, tree
*** 5640,5651 ****
if (rhs == error_mark_node || rhstype == error_mark_node)
return error_mark_node;
if (TREE_CODE (rhs) == TREE_LIST && TREE_VALUE (rhs) == error_mark_node)
return error_mark_node;
- rhs = dubious_conversion_warnings (type, rhs, errtype, fndecl, parmnum);
-
/* The RHS of an assignment cannot have void type. */
if (coder == VOID_TYPE)
{
error ("void value not ignored as it ought to be");
return error_mark_node;
--- 5640,5649 ----
Index: testsuite/g++.dg/warn/conv2.C
===================================================================
RCS file: testsuite/g++.dg/warn/conv2.C
diff -N testsuite/g++.dg/warn/conv2.C
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/warn/conv2.C 5 Feb 2004 05:16:28 -0000
***************
*** 0 ****
--- 1,3 ----
+ // PR c++/13932
+
+ int i = 1.; // { dg-warning "converting" }