PR bootstrap/68361
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 17 Nov 2015 18:16:29 +0000 (18:16 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 17 Nov 2015 18:16:29 +0000 (18:16 +0000)
* cvt.c (cp_convert_and_check): Use warning_sentinel to suppress
-Wparentheses.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@230470 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/cvt.c
gcc/testsuite/g++.dg/warn/Wparentheses-28.C [new file with mode: 0644]

index 05b9252..e410300 100644 (file)
@@ -1,3 +1,9 @@
+2015-11-17  Jason Merrill  <jason@redhat.com>
+
+       PR bootstrap/68361
+       * cvt.c (cp_convert_and_check): Use warning_sentinel to suppress
+       -Wparentheses.
+
 2015-11-16  Jason Merrill  <jason@redhat.com>
 
        * constexpr.c (cxx_eval_builtin_function_call): Use cp_fully_fold
index 0231efc..ebca004 100644 (file)
@@ -644,7 +644,7 @@ cp_convert_and_check (tree type, tree expr, tsubst_flags_t complain)
       else
        {
          /* Avoid bogus -Wparentheses warnings.  */
-         TREE_NO_WARNING (folded) = true;
+         warning_sentinel w (warn_parentheses);
          folded_result = cp_convert (type, folded, tf_none);
        }
       folded_result = fold_simple (folded_result);
diff --git a/gcc/testsuite/g++.dg/warn/Wparentheses-28.C b/gcc/testsuite/g++.dg/warn/Wparentheses-28.C
new file mode 100644 (file)
index 0000000..f6636cb
--- /dev/null
@@ -0,0 +1,14 @@
+// PR bootstrap/68361
+// { dg-options -Wparentheses }
+
+struct A
+{
+  int p: 2;
+};
+
+A a, b;
+
+int main()
+{
+  bool t = (a.p = b.p);
+}