re PR c++/33208 (Broken diagnostic: 'component_ref' not supported by dump_decl)
authorPaolo Carlini <pcarlini@suse.de>
Sun, 2 Sep 2007 13:02:31 +0000 (13:02 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Sun, 2 Sep 2007 13:02:31 +0000 (13:02 +0000)
/cp
2007-09-02  Paolo Carlini  <pcarlini@suse.de>

PR c++/33208
* typeck.c (build_unary_op): Fix error message for
Boolean expression as operand to operator--.

/testsuite
2007-09-02  Paolo Carlini  <pcarlini@suse.de>

PR c++/33208
* g++.dg/other/error18.C: New.
* g++.dg/expr/bitfield3.C: Adjust.

From-SVN: r128025

gcc/cp/ChangeLog
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/expr/bitfield3.C
gcc/testsuite/g++.dg/other/error18.C [new file with mode: 0644]

index 7b1b70fa5e992d827c324f4419f83f548f8303c7..43883e659730557a194b5065b6124f2ffa9f9edd 100644 (file)
@@ -1,3 +1,9 @@
+2007-09-02  Paolo Carlini  <pcarlini@suse.de>
+
+       PR c++/33208
+       * typeck.c (build_unary_op): Fix error message for
+       Boolean expression as operand to operator--.
+
 2007-09-01  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * tree.c (pod_type_p, zero_init_p): Use strip_array_types.
index b57fbe5455fb39ea3154e43486b0deaa952fdc94..ae39b59bb07866c9331f190f684d76eb66c6a076 100644 (file)
@@ -4323,7 +4323,8 @@ build_unary_op (enum tree_code code, tree xarg, int noconvert)
          {
            if (code == POSTDECREMENT_EXPR || code == PREDECREMENT_EXPR)
              {
-               error ("invalid use of %<--%> on bool variable %qD", arg);
+               error ("invalid use of Boolean expression as operand "
+                      "to %<operator--%>");
                return error_mark_node;
              }
            val = boolean_increment (code, arg);
index 3efc89695ee523a660ae163f7b057925bfeae33a..9508d1adfe76ee95fd32628d824319e7e20c86c1 100644 (file)
@@ -1,3 +1,9 @@
+2007-09-02  Paolo Carlini  <pcarlini@suse.de>
+
+       PR c++/33208
+       * g++.dg/other/error18.C: New.
+       * g++.dg/expr/bitfield3.C: Adjust.
+
 2007-09-02  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR fortran/33276
index 7b856e9e8b872601857cf200a7ff6c2c435326e9..3221263a9066931c415c82271ee27cb145baca68 100644 (file)
@@ -7,6 +7,6 @@ struct S {
 S s;
 
 void f() {
-  s.x--; // { dg-error "bool" }
-  --s.x; // { dg-error "bool" }
+  s.x--; // { dg-error "Boolean expression" }
+  --s.x; // { dg-error "Boolean expression" }
 }
diff --git a/gcc/testsuite/g++.dg/other/error18.C b/gcc/testsuite/g++.dg/other/error18.C
new file mode 100644 (file)
index 0000000..9e4d21c
--- /dev/null
@@ -0,0 +1,11 @@
+// PR c++/33208
+
+struct A
+{
+  bool b;
+};
+
+void f(A a)
+{
+  a.b--; // { dg-error "Boolean expression" }
+}