re PR c++/36607 (Incorrect type diagnostic on substracting casted char pointers)

2009-02-03  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR C++/36607
        * convert.c (convert_to_integer): Treat OFFSET_TYPE like INTEGER_TYPE.

2009-02-03  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR C++/36607
        * g++.dg/expr/cast10.C: New test.

From-SVN: r143909
This commit is contained in:
Andrew Pinski 2009-02-03 22:38:16 +00:00 committed by Andrew Pinski
parent d4f4bc84b0
commit 6175f5785a
4 changed files with 21 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2009-02-03 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR C++/36607
* convert.c (convert_to_integer): Treat OFFSET_TYPE like INTEGER_TYPE.
2009-02-03 Jakub Jelinek <jakub@redhat.com>
* gcc.c (process_command): Update copyright notice dates.

View File

@ -493,6 +493,7 @@ convert_to_integer (tree type, tree expr)
case INTEGER_TYPE:
case ENUMERAL_TYPE:
case BOOLEAN_TYPE:
case OFFSET_TYPE:
/* If this is a logical operation, which just returns 0 or 1, we can
change the type of the expression. */

View File

@ -1,3 +1,8 @@
2009-02-03 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR C++/36607
* g++.dg/expr/cast10.C: New test.
2009-02-03 Joseph Myers <joseph@codesourcery.com>
PR c/35433

View File

@ -0,0 +1,10 @@
// { dg-do compile }
// This used to error out because we would try to convert m to a short.
struct a {};
void b() {
int a::*m;
a *c;
short p = reinterpret_cast<char*>(&(c->*m)) - reinterpret_cast<char*>(c);
}