mirror of git://gcc.gnu.org/git/gcc.git
re PR c++/39365 (++ operator with volatile bool increments)
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 Andrew Pinski <pinskia@gcc.gnu.org> PR c++/39365 * g++.dg/expr/bool3.C: New test. * g++.dg/expr/bool4.C: New test. From-SVN: r151823
This commit is contained in:
parent
695a8e6210
commit
66be89f022
|
@ -1,3 +1,9 @@
|
|||
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>
|
||||
|
||||
|
|
|
@ -1287,7 +1287,7 @@ type_promotes_to (tree type)
|
|||
|
||||
/* 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
|
||||
|
|
|
@ -4556,7 +4556,7 @@ cp_build_unary_op (enum tree_code code, tree xarg, int noconvert,
|
|||
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)
|
||||
{
|
||||
|
@ -6787,7 +6787,7 @@ convert_for_assignment (tree type, tree rhs,
|
|||
/* 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
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
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.
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
// { 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;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
// { 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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue