This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH: Fix C++/10784
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: gcc-patches at gcc dot gnu dot org
- Date: 21 Jun 2003 19:43:16 +0200
- Subject: C++ PATCH: Fix C++/10784
- Organization: Integrable Solutions
Thsi fixes PR C++/10784 by making the diagnostic fall in the
-Wconversion category.
Regtested on an i686-pc-linux-gnu.
Applied to branch and mainline.
-- Gaby
2003-06-21 Gabriel Dos Reis <gdr@integrable-solutions.net>
cp/
PR c++/10784
* call.c (joust): Warn about choosing conversion sequence only if
-Wconversion.
testsuite/
* g++.old-deja/g++.benjamin/16077.C: Add -Wconversion option.
* g++.old-deja/g++.other/conv7.C: Likewise
* g++.old-deja/g++.other/overcnv2.C: Likewise.
* g++.old-deja/g++.other/overload14.C: Likewise.
Index: cp/call.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/call.c,v
retrieving revision 1.341.2.22
diff -p -r1.341.2.22 call.c
*** cp/call.c 21 Jun 2003 16:41:36 -0000 1.341.2.22
--- cp/call.c 21 Jun 2003 17:24:19 -0000
*************** joust (cand1, cand2, warn)
*** 5710,5716 ****
&& TREE_CODE (convn) == QUAL_CONV)
/* Don't complain about `operator char *()' beating
`operator const char *() const'. */;
! else if (warn)
{
tree source = source_type (TREE_VEC_ELT (w->convs, 0));
if (! DECL_CONSTRUCTOR_P (w->fn))
--- 5710,5716 ----
&& TREE_CODE (convn) == QUAL_CONV)
/* Don't complain about `operator char *()' beating
`operator const char *() const'. */;
! else if (warn && warn_conversion)
{
tree source = source_type (TREE_VEC_ELT (w->convs, 0));
if (! DECL_CONSTRUCTOR_P (w->fn))
Index: testsuite/g++.old-deja/g++.benjamin/16077.C
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.old-deja/g++.benjamin/16077.C,v
retrieving revision 1.2
diff -p -r1.2 16077.C
*** testsuite/g++.old-deja/g++.benjamin/16077.C 16 Dec 1998 21:21:58 -0000 1.2
--- testsuite/g++.old-deja/g++.benjamin/16077.C 21 Jun 2003 17:24:25 -0000
***************
*** 1,6 ****
// 981203 bkoz
// g++/16077
! // Build don't link:
class nicaragua;
struct colombia {
--- 1,7 ----
// 981203 bkoz
// g++/16077
! // Build don't link:
! // Special Options: -Wconversion
class nicaragua;
struct colombia {
Index: testsuite/g++.old-deja/g++.other/conv7.C
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.old-deja/g++.other/conv7.C,v
retrieving revision 1.2
diff -p -r1.2 conv7.C
*** testsuite/g++.old-deja/g++.other/conv7.C 5 Jun 2001 12:53:52 -0000 1.2
--- testsuite/g++.old-deja/g++.other/conv7.C 21 Jun 2003 17:24:26 -0000
***************
*** 5,10 ****
--- 5,11 ----
// Bug 2726. We ICE'd trying to say something about possibly confusing
// conversion overload resolution.
+ // Special Options: -Wconversion
class foo
{
Index: testsuite/g++.old-deja/g++.other/overcnv2.C
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.old-deja/g++.other/overcnv2.C,v
retrieving revision 1.2
diff -p -r1.2 overcnv2.C
*** testsuite/g++.old-deja/g++.other/overcnv2.C 21 Jul 1999 08:53:37 -0000 1.2
--- testsuite/g++.old-deja/g++.other/overcnv2.C 21 Jun 2003 17:24:26 -0000
***************
*** 2,7 ****
--- 2,8 ----
// warn about it. We choose op char* not because it is a member of B --
// the standard says that all conversion ops are treated as coming from
// the type of the argument -- but because it is non-const.
+ // Special Options: -Wconversion
struct A {
operator const char *() const { return ""; }
Index: testsuite/g++.old-deja/g++.other/overload14.C
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.old-deja/g++.other/overload14.C,v
retrieving revision 1.1
diff -p -r1.1 overload14.C
*** testsuite/g++.old-deja/g++.other/overload14.C 20 Apr 2001 08:17:19 -0000 1.1
--- testsuite/g++.old-deja/g++.other/overload14.C 21 Jun 2003 17:24:26 -0000
***************
*** 1,3 ****
--- 1,5 ----
+ // Special Options: -Wconversion
+
extern "C" void abort();
struct A {