diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 88c91dbe873..7f0c4ede4c0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2003-06-21 Gabriel Dos Reis + + PR c++/10915 + * decl.c (grok_op_properties): Warn possible confusing conversion + only if -Wconversion. + 2003-06-20 Mark Mitchell PR c++/10749 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index d73c0d08f99..f539842c295 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -12371,7 +12371,7 @@ grok_op_properties (tree decl, int friendp) && DERIVED_FROM_P (t, current_class_type)) what = "a base class"; - if (what) + if (what && warn_conversion) warning ("conversion to %s%s will never use a type conversion operator", ref ? "a reference to " : "", what); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a0b977744f6..a947a8fc5e0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2003-06-21 Gabriel Dos Reis + + * g++.old-deja/g++.jason/conversion5.C: Adjust option. + * g++.old-deja/g++.bugs/900215_01.C: Likewise. + 2003-06-20 Mark Mitchell PR c++/10888 diff --git a/gcc/testsuite/g++.dg/warn/conversion-function-1.C b/gcc/testsuite/g++.dg/warn/conversion-function-1.C new file mode 100644 index 00000000000..878011cf328 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/conversion-function-1.C @@ -0,0 +1,8 @@ +// Copyright (C) 2003 Free Software Foundation +// Contributed by Gabriel Dos Reis +// { dg-options "-Wno-conversion" } + +struct A { + operator A&(); +}; + diff --git a/gcc/testsuite/g++.old-deja/g++.bugs/900215_01.C b/gcc/testsuite/g++.old-deja/g++.bugs/900215_01.C index 768105791aa..c79a7035f99 100644 --- a/gcc/testsuite/g++.old-deja/g++.bugs/900215_01.C +++ b/gcc/testsuite/g++.old-deja/g++.bugs/900215_01.C @@ -20,6 +20,8 @@ // 8/3/2000 (nathan): The std allows you to define such an op, but // it will never be called. [class.conv.fct]. Make it an unconditional warning. +// { dg-options "-Wconversion" } + struct struct0 { operator void (); // { dg-warning "" } operator void diff --git a/gcc/testsuite/g++.old-deja/g++.jason/conversion5.C b/gcc/testsuite/g++.old-deja/g++.jason/conversion5.C index e409fae54af..0031084db00 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/conversion5.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/conversion5.C @@ -1,4 +1,5 @@ // { dg-do assemble } +// { dg-options "-Wconversion" } struct A { }; struct B: public A { A a;