]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/27177 (ICE in build_simple_base_path, at cp/class.c:474)
authorJason Merrill <jason@redhat.com>
Mon, 28 Jan 2008 16:18:56 +0000 (11:18 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 28 Jan 2008 16:18:56 +0000 (11:18 -0500)
        PR c++/27177
        * class.c (build_base_path): Fix previous change.

        PR c++/27177
        * class.c (build_base_path): Don't mess with virtual access if
        skip_evaluation.
        * call.c (standard_conversion): Don't check whether source type
        is complete.

From-SVN: r131905

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/class.c

index fa2127a50654fa24c88f2e84e974055ce42c24ca..f850ad63bf8aed0cac51e1284b92bbbe58a1792b 100644 (file)
@@ -1,3 +1,14 @@
+2008-01-27  Jason Merrill  <jason@redhat.com>
+
+       PR c++/27177
+       * class.c (build_base_path): Fix previous change.
+
+       PR c++/27177
+       * class.c (build_base_path): Don't mess with virtual access if
+       skip_evaluation.
+       * call.c (standard_conversion): Don't check whether source type
+       is complete.
+
 2008-01-23  Jason Merrill  <jason@redhat.com>
 
        PR bootstrap/34944
index 244cab1c1f341a680f7ae1ca65c8eceafb788476..12274332fee66ca90a9c973d3ba7f87fb6228add 100644 (file)
@@ -724,19 +724,7 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p,
                  that necessitates this conversion is ill-formed.
                  Therefore, we use DERIVED_FROM_P, and do not check
                  access or uniqueness.  */
-              && DERIVED_FROM_P (TREE_TYPE (to), TREE_TYPE (from))
-              /* If FROM is not yet complete, then we must be parsing
-                 the body of a class.  We know what's derived from
-                 what, but we can't actually perform a
-                 derived-to-base conversion.  For example, in:
-
-                    struct D : public B { 
-                       static const int i = sizeof((B*)(D*)0);
-                     };
-
-                  the D*-to-B* conversion is a reinterpret_cast, not a
-                 static_cast.  */
-              && COMPLETE_TYPE_P (TREE_TYPE (from)))
+              && DERIVED_FROM_P (TREE_TYPE (to), TREE_TYPE (from)))
        {
          from =
            cp_build_qualified_type (TREE_TYPE (to),
index 878f03166a0c446a0639b7d932e043f1a110fbac..00b2e3a131b434ae1517bb431a4995a73d7adf76 100644 (file)
@@ -293,6 +293,11 @@ build_base_path (enum tree_code code,
   /* Do we need to look in the vtable for the real offset?  */
   virtual_access = (v_binfo && fixed_type_p <= 0);
 
+  /* Don't bother with the calculations inside sizeof; they'll ICE if the
+     source type is incomplete and the pointer value doesn't matter.  */
+  if (skip_evaluation)
+    return build_nop (build_pointer_type (target_type), expr);
+
   /* Do we need to check for a null pointer?  */
   if (want_pointer && !nonnull)
     {