aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2007-09-02 13:02:31 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2007-09-02 13:02:31 +0000
commit8bcebc69b873883d1180382c9599ff563d9b9264 (patch)
treeae71ffb5704ca917b50ae4f9d544b10fe804cd43
parent669141025a2d25735de6fdded6c4836fcff3feec (diff)
downloadgcc-8bcebc69b873883d1180382c9599ff563d9b9264.zip
gcc-8bcebc69b873883d1180382c9599ff563d9b9264.tar.gz
gcc-8bcebc69b873883d1180382c9599ff563d9b9264.tar.bz2
re PR c++/33208 (Broken diagnostic: 'component_ref' not supported by dump_decl)
/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
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/typeck.c3
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/g++.dg/expr/bitfield3.C4
-rw-r--r--gcc/testsuite/g++.dg/other/error18.C11
5 files changed, 27 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 7b1b70f..43883e6 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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.
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index b57fbe5..ae39b59 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -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);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 3efc896..9508d1a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
diff --git a/gcc/testsuite/g++.dg/expr/bitfield3.C b/gcc/testsuite/g++.dg/expr/bitfield3.C
index 7b856e9..3221263 100644
--- a/gcc/testsuite/g++.dg/expr/bitfield3.C
+++ b/gcc/testsuite/g++.dg/expr/bitfield3.C
@@ -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
index 0000000..9e4d21c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/error18.C
@@ -0,0 +1,11 @@
+// PR c++/33208
+
+struct A
+{
+ bool b;
+};
+
+void f(A a)
+{
+ a.b--; // { dg-error "Boolean expression" }
+}