From: Gabriel Dos Reis Date: Sat, 21 Jun 2003 17:39:58 +0000 (+0000) Subject: re PR c++/10784 (Warning about choosing custom operator over copy constructor cannot... X-Git-Tag: releases/gcc-3.4.0~5584 X-Git-Url: https://gcc.gnu.org/git/?a=commitdiff_plain;h=25abc0a5efa834a9a39d44f942d3bc3cc5480771;p=gcc.git re PR c++/10784 (Warning about choosing custom operator over copy constructor cannot be turned off (and it's useless in the first place)) 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. From-SVN: r68312 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0e679c9268ba..7809040519e2 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,6 +1,12 @@ +2003-06-21 Gabriel Dos Reis + + PR c++/10784 + * call.c (joust): Warn about choosing conversion sequence only if + -Wconversion. + 2003-06-21 Gabriel Dos Reis - PC c++/10864 + PR c++/10864 * call.c (op_error): Tidy. * error.c (dump_expr): Properly format 'T()' when T is an aggregate type. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 48e36421223c..bb1ad5b91bce 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -5807,7 +5807,7 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn) if (!give_warning) /*NOP*/; - else if (warn) + else if (warn && warn_conversion) { tree source = source_type (TREE_VEC_ELT (w->convs, 0)); if (! DECL_CONSTRUCTOR_P (w->fn)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a947a8fc5e00..4e3c4cf24fd7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2003-06-21 Gabriel Dos Reis + + * 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. + 2003-06-21 Gabriel Dos Reis * g++.old-deja/g++.jason/conversion5.C: Adjust option. diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/16077.C b/gcc/testsuite/g++.old-deja/g++.benjamin/16077.C index edffef2ae076..9f854b5e189b 100644 --- a/gcc/testsuite/g++.old-deja/g++.benjamin/16077.C +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/16077.C @@ -1,6 +1,7 @@ // { dg-do assemble } // 981203 bkoz // g++/16077 +// { dg-options "-Wconversion" } class nicaragua; struct colombia { diff --git a/gcc/testsuite/g++.old-deja/g++.other/conv7.C b/gcc/testsuite/g++.old-deja/g++.other/conv7.C index 71ec20425485..7042e147ca55 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/conv7.C +++ b/gcc/testsuite/g++.old-deja/g++.other/conv7.C @@ -1,4 +1,5 @@ // { dg-do assemble } +// { dg-options "-Wconversion" } // // Copyright (C) 2001 Free Software Foundation, Inc. // Contributed by Nathan Sidwell 5 May 2001 diff --git a/gcc/testsuite/g++.old-deja/g++.other/overcnv2.C b/gcc/testsuite/g++.old-deja/g++.other/overcnv2.C index ab877d109932..ef9c1f7823b8 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/overcnv2.C +++ b/gcc/testsuite/g++.old-deja/g++.other/overcnv2.C @@ -1,4 +1,5 @@ // { dg-do assemble } +// { dg-options "-Wconversion" } // Test that we resolve this case as mandated by the standard, but also // 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 diff --git a/gcc/testsuite/g++.old-deja/g++.other/overload14.C b/gcc/testsuite/g++.old-deja/g++.other/overload14.C index 28d5f47e42a5..2a50b1bf5104 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/overload14.C +++ b/gcc/testsuite/g++.old-deja/g++.other/overload14.C @@ -1,4 +1,5 @@ // { dg-do run } +// { dg-options "-Wconversion" } extern "C" void abort(); struct A {