]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/19666 (Trouble with prt-to-members: rejects-valid/ICE in fold_convert)
authorJakub Jelinek <jakub@redhat.com>
Fri, 11 Feb 2005 21:12:48 +0000 (22:12 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 11 Feb 2005 21:12:48 +0000 (22:12 +0100)
PR c++/19666
2004-06-08  Andrew Pinski  <pinskia@physics.uc.edu>
* fold-const.c (fold_convert): Treat OFFSET_TYPE like
POINTER_TYPE and INTEGER_TYPE.

* gcc/testsuite/g++.dg/other/ptrmem6.C: New test.

[[Split portion of a mixed commit.]]

From-SVN: r94893.1

gcc/ChangeLog
gcc/fold-const.c

index 730a39439daae842f6b411e5af508b420d4ad1f7..7339f09b8eed30fe0ff39725948373498fed006b 100644 (file)
@@ -1,5 +1,10 @@
 2005-02-11  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c++/19666
+       2004-06-08  Andrew Pinski  <pinskia@physics.uc.edu>
+       * fold-const.c (fold_convert): Treat OFFSET_TYPE like
+       POINTER_TYPE and INTEGER_TYPE.
+
        * config/rs6000/sysv4.h (ENDFILE_LINUX_SPEC): Use crtendS.o instead of
        crtend.o if -pie.  Use %{x:a;:b} spec syntax.
 
index e0889ce55cfd3d6aa84d0e2b8efe7e18a6eeea6a..b34422f15aaff7d7082c702adc8d74521b3c2144 100644 (file)
@@ -1828,7 +1828,8 @@ fold_convert (tree type, tree arg)
   if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (orig))
     return fold (build1 (NOP_EXPR, type, arg));
 
-  if (INTEGRAL_TYPE_P (type) || POINTER_TYPE_P (type))
+  if (INTEGRAL_TYPE_P (type) || POINTER_TYPE_P (type)
+      || TREE_CODE (type) == OFFSET_TYPE)
     {
       if (TREE_CODE (arg) == INTEGER_CST)
        {
@@ -1836,7 +1837,8 @@ fold_convert (tree type, tree arg)
          if (tem != NULL_TREE)
            return tem;
        }
-      if (INTEGRAL_TYPE_P (orig) || POINTER_TYPE_P (orig))
+      if (INTEGRAL_TYPE_P (orig) || POINTER_TYPE_P (orig)
+         || TREE_CODE (orig) == OFFSET_TYPE)
         return fold (build1 (NOP_EXPR, type, arg));
       if (TREE_CODE (orig) == COMPLEX_TYPE)
        {