OSDN Git Service

2009-02-03 Andrew Pinski <andrew_pinski@playstation.sony.com>
authorpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 3 Feb 2009 22:38:16 +0000 (22:38 +0000)
committerpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 3 Feb 2009 22:38:16 +0000 (22:38 +0000)
        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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@143909 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/convert.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/expr/cast10.C [new file with mode: 0644]

index af8d0e9..c7d7b01 100644 (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.
index 1a462e7..77907ba 100644 (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.  */
 
index 20d0b4a..9d50d7f 100644 (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
diff --git a/gcc/testsuite/g++.dg/expr/cast10.C b/gcc/testsuite/g++.dg/expr/cast10.C
new file mode 100644 (file)
index 0000000..cd3e0fc
--- /dev/null
@@ -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);
+}