aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAndrew Pinski <andrew_pinski@playstation.sony.com>2009-02-03 22:38:16 +0000
committerAndrew Pinski <pinskia@gcc.gnu.org>2009-02-03 14:38:16 -0800
commit6175f5785a720106f5f6c2c051f46aac8a2d7a01 (patch)
treeae6a30abb743de5289697d5624977c3689457c4a /gcc
parentd4f4bc84b0a55234f92c0dcb3289a8ad5816e7cb (diff)
downloadgcc-6175f5785a720106f5f6c2c051f46aac8a2d7a01.zip
gcc-6175f5785a720106f5f6c2c051f46aac8a2d7a01.tar.gz
gcc-6175f5785a720106f5f6c2c051f46aac8a2d7a01.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/convert.c1
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/expr/cast10.C10
4 files changed, 21 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index af8d0e9..c7d7b01 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/convert.c b/gcc/convert.c
index 1a462e7..77907ba 100644
--- a/gcc/convert.c
+++ b/gcc/convert.c
@@ -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. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 20d0b4a..9d50d7f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
diff --git a/gcc/testsuite/g++.dg/expr/cast10.C b/gcc/testsuite/g++.dg/expr/cast10.C
new file mode 100644
index 0000000..cd3e0fc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/expr/cast10.C
@@ -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);
+}