This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/17120] [3.5 regression] warning: suggest parentheses around assignment used as truth value


------- Additional Comments From reichelt at gcc dot gnu dot org  2004-08-20 15:11 -------
As for a testcase, one should probably extend Wparentheses-3.C a little bit:

====================================================================
--- Wparentheses-3.C   2004-08-20 17:07:20.000000000 +0200
+++ Wparentheses-3.C   2004-08-20 17:08:21.000000000 +0200
@@ -1,5 +1,5 @@
 // Test that -Wparentheses does not give bogus warnings in the
-// presence of templates.  Bug 17041.
+// presence of templates.  PR c++/17041 and PR c++/17120.
 
 // { dg-do compile }
 // { dg-options "-Wparentheses" }
@@ -7,7 +7,11 @@
 template<int> struct A
 {
     int i;
-    A() { if ((i = 0)) ; }
+    A()
+    {
+        if ((i = 0)) ;
+        if (i >>= 0) ;
+    }
 };
 
 A<0> a;
====================================================================


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17120


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]