+2009-09-17 Andrew Pinski <pinskia@gcc.gnu.org>
+
+ PR c++/39365
+ * g++.dg/expr/bool3.C: New test.
+ * g++.dg/expr/bool4.C: New test.
+
2009-09-14 Richard Henderson <rth@redhat.com>
Jakub Jelinek <jakub@redhat.com>
/* bool always promotes to int (not unsigned), even if it's the same
size. */
- if (type == boolean_type_node)
+ if (TREE_CODE (type) == BOOLEAN_TYPE)
type = integer_type_node;
/* Normally convert enums to int, but convert wide enums to something
return error_mark_node;
/* Forbid using -- on `bool'. */
- if (same_type_p (declared_type, boolean_type_node))
+ if (TREE_CODE (declared_type) == BOOLEAN_TYPE)
{
if (code == POSTDECREMENT_EXPR || code == PREDECREMENT_EXPR)
{
/* If -Wparentheses, warn about a = b = c when a has type bool and b
does not. */
if (warn_parentheses
- && type == boolean_type_node
+ && TREE_CODE (type) == BOOLEAN_TYPE
&& TREE_CODE (rhs) == MODIFY_EXPR
&& !TREE_NO_WARNING (rhs)
&& TREE_CODE (TREE_TYPE (rhs)) != BOOLEAN_TYPE
+2009-09-17 Andrew Pinski <pinskia@gcc.gnu.org>
+
+ PR c++/39365
+ * typeck.c (cp_build_unary_op): Check TREE_CODE for bools instead of
+ using same_type_p.
+ (convert_for_assignment): Likewise.
+ * cvt.c (type_promotes_to): Likewise.
+
2009-09-17 Janis Johnson <janis187@us.ibm.com>
* gcc/testsuite/gcc.dg/dfp/dfp-dbg.h: Define EXTERN.
--- /dev/null
+// { dg-do run }
+// PR C++/29295
+// make sure that a typedef for a bool will have the
+// the same results as a bool itself.
+
+extern "C" void abort();
+typedef volatile bool my_bool;
+int main()
+{
+ my_bool b = false;
+ int i;
+
+ b++;
+ b++;
+ i = b;
+ if (i != 1)
+ abort ();
+ return 0;
+}
+
+
--- /dev/null
+// { dg-do compile }
+// make sure that a typedef for a bool will have the
+// the same results as a bool itself.
+
+
+typedef volatile bool my_bool;
+int main()
+{
+ my_bool b = false;
+ b--; // { dg-error "" }
+ return 0;
+}
+