]> 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:27:17 +0000 (11:27 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 28 Jan 2008 16:27:17 +0000 (11:27 -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.

        PR c++/33959
        * pt.c (tsubst_aggr_type): Make sure our context is complete.

From-SVN: r131907

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

index 85e439bd78614f83f405d1af6d62a8f26942bb23..0dd212a6edff49e9094cb14713159c209018675e 100644 (file)
@@ -1,3 +1,17 @@
+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.
+
+       PR c++/33959
+       * pt.c (tsubst_aggr_type): Make sure our context is complete.
+
 2007-10-26  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/33744
index b9941bc401529328d7d45d577ed0a6b5d1f20092..508982d3e4cc2ea35c52d752d25bf760eace9666 100644 (file)
@@ -714,19 +714,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 5249c8b72ab2b8dbecb2438fe5bc8c1d245343c9..9d7dd8800fd07c0b1e203ca9e458d3c5dc434554 100644 (file)
@@ -294,6 +294,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)
     {
index 2c91eb0718ccdd781d8cafc8a64426b8430fae5b..e3d5d05cb4858af6b9eaa6a4d32aca9e8ab4de05 100644 (file)
@@ -6164,8 +6164,14 @@ tsubst_aggr_type (tree t,
             up.  */
          context = TYPE_CONTEXT (t);
          if (context)
-           context = tsubst_aggr_type (context, args, complain,
-                                       in_decl, /*entering_scope=*/1);
+           {
+             context = tsubst_aggr_type (context, args, complain,
+                                         in_decl, /*entering_scope=*/1);
+             /* If context is a nested class inside a class template,
+                it may still need to be instantiated (c++/33959).  */
+             if (TYPE_P (context))
+               complete_type (context);
+           }
 
          /* Then, figure out what arguments are appropriate for the
             type we are trying to find.  For example, given: