]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/10915 (a not-useful non-avoidable warning: conversion to a reference to...
authorGabriel Dos Reis <gdr@integrable-solutions.net>
Sat, 21 Jun 2003 13:09:05 +0000 (13:09 +0000)
committerGabriel Dos Reis <gdr@gcc.gnu.org>
Sat, 21 Jun 2003 13:09:05 +0000 (13:09 +0000)
testsuite/
        * g++.old-deja/g++.jason/conversion5.C: Adjust option.
        * g++.old-deja/g++.bugs/900215_01.C: Likewise.

cp/
        PR c++/10915
        * decl.c (grok_op_properties): Warn possible confusing conversion
        only if -Wconversion.

From-SVN: r68303

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/warn/conversion-function-1.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.bugs/900215_01.C
gcc/testsuite/g++.old-deja/g++.jason/conversion5.C

index 88c91dbe873938c5892f6ef58437387e9eccd140..7f0c4ede4c0ecfa6087033a6d81590d5dd210368 100644 (file)
@@ -1,3 +1,9 @@
+2003-06-21  Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+       PR c++/10915
+       * decl.c (grok_op_properties): Warn possible confusing conversion
+       only if -Wconversion.
+
 2003-06-20  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/10749
index d73c0d08f996f0f3cf9532da22b5387b376af242..f539842c2953033ea5fc26f69f8ed2863bc1cf5f 100644 (file)
@@ -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);
            }
index a0b977744f6539aa171ec1030d6267d0fabdf634..a947a8fc5e008777c19719893727b1a6b6bf954f 100644 (file)
@@ -1,3 +1,8 @@
+2003-06-21  Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+       * g++.old-deja/g++.jason/conversion5.C: Adjust option.
+       * g++.old-deja/g++.bugs/900215_01.C: Likewise.
+
 2003-06-20  Mark Mitchell  <mark@codesourcery.com>
 
        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 (file)
index 0000000..878011c
--- /dev/null
@@ -0,0 +1,8 @@
+// Copyright (C) 2003 Free Software Foundation
+// Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
+// { dg-options "-Wno-conversion" }
+
+struct A {
+   operator A&();
+};
+
index 768105791aa285e36a5178c968fdce776ba3dc4f..c79a7035f99de1432976b95f7f7bd509aa6b85ac 100644 (file)
@@ -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
index e409fae54afe52751abde622e363e400d01768c1..0031084db004d4f8cadfd8436ec724e42ac71191 100644 (file)
@@ -1,4 +1,5 @@
 // { dg-do assemble  }
+// { dg-options "-Wconversion" }
 struct A { };
 struct B: public A {
   A a;