]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/4377 (more errors with multiple non-type template parameters)
authorJason Merrill <jason@redhat.com>
Mon, 18 Mar 2002 13:50:56 +0000 (08:50 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 18 Mar 2002 13:50:56 +0000 (08:50 -0500)
        PR c++/4377
        * mangle.c (write_expression): Strip NOP_EXPRs sooner.  Also strip
        NON_LVALUE_EXPRs.

        PR c++/4003
        * pt.c (tsubst_friend_function): Use decl_namespace_context.

        PR c++/5757
        * init.c (build_new_1): Pass the right pointer to op delete.

From-SVN: r50969

gcc/cp/ChangeLog
gcc/cp/init.c
gcc/cp/mangle.c
gcc/cp/pt.c

index d9974bef34b8dd8698305edb7a6855ca44f7e7b0..16e13b73b8382e1a7c9b444df7da58170752a175 100644 (file)
@@ -1,6 +1,16 @@
-2002-02-20  Release Manager
+2002-03-18  Jason Merrill  <jason@redhat.com>
 
-       * GCC 3.0.4 Released.
+       PR c++/4377
+       * mangle.c (write_expression): Strip NOP_EXPRs sooner.  Also strip
+       NON_LVALUE_EXPRs.
+
+       PR c++/4003
+       * pt.c (tsubst_friend_function): Use decl_namespace_context.
+
+2002-03-17  Jason Merrill  <jason@redhat.com>
+
+       PR c++/5757
+       * init.c (build_new_1): Pass the right pointer to op delete.
 
 2002-02-20  Release Manager
 
index 151ca3d7c9bff5e63193d7ca2a8e402aadf34ecf..e16e8be92936f68baa11b0f4c55b5759ea43c087 100644 (file)
@@ -2548,13 +2548,22 @@ build_new_1 (exp)
          tree cleanup;
          int flags = (LOOKUP_NORMAL 
                       | (globally_qualified_p * LOOKUP_GLOBAL));
+         tree delete_node;
+
+         if (use_cookie)
+           /* Subtract the padding back out to get to the pointer returned
+              from operator new.  */
+           delete_node = fold (build (MINUS_EXPR, TREE_TYPE (alloc_node),
+                                      alloc_node, cookie_size));
+         else
+           delete_node = alloc_node;
 
          /* The Standard is unclear here, but the right thing to do
              is to use the same method for finding deallocation
              functions that we use for finding allocation functions.  */
          flags |= LOOKUP_SPECULATIVELY;
 
-         cleanup = build_op_delete_call (dcode, alloc_node, size, flags,
+         cleanup = build_op_delete_call (dcode, delete_node, size, flags,
                                          (placement_allocation_fn_p 
                                           ? alloc_call : NULL_TREE));
 
index 3f99dec2cf5cf7827790ecddbcb10beeda6f0763..d675a7d9bad836769da40fd18b55d73e609c9c12 100644 (file)
@@ -1768,6 +1768,16 @@ write_expression (expr)
       code = TREE_CODE (expr);
     }
 
+  /* Skip NOP_EXPRs.  They can occur when (say) a pointer argument
+     is converted (via qualification conversions) to another
+     type.  */
+  while (TREE_CODE (expr) == NOP_EXPR
+        || TREE_CODE (expr) == NON_LVALUE_EXPR)
+    {
+      expr = TREE_OPERAND (expr, 0);
+      code = TREE_CODE (expr);
+    }
+
   /* Handle template parameters. */
   if (code == TEMPLATE_TYPE_PARM 
       || code == TEMPLATE_TEMPLATE_PARM
@@ -1787,15 +1797,6 @@ write_expression (expr)
     {
       int i;
 
-      /* Skip NOP_EXPRs.  They can occur when (say) a pointer argument
-        is converted (via qualification conversions) to another
-        type.  */
-      while (TREE_CODE (expr) == NOP_EXPR)
-       {
-         expr = TREE_OPERAND (expr, 0);
-         code = TREE_CODE (expr);
-       }
-
       /* When we bind a variable or function to a non-type template
         argument with reference type, we create an ADDR_EXPR to show
         the fact that the entity's address has been taken.  But, we
index b552d9831f4455c0b95c968785e96b1a878cebad..22b06416bacc2fd03af17f7774c5ef8220ff15b7 100644 (file)
@@ -4552,7 +4552,7 @@ tsubst_friend_function (decl, args)
       tree template_id, arglist, fns;
       tree new_args;
       tree tmpl;
-      tree ns = CP_DECL_CONTEXT (TYPE_MAIN_DECL (current_class_type));
+      tree ns = decl_namespace_context (TYPE_MAIN_DECL (current_class_type));
       
       /* Friend functions are looked up in the containing namespace scope.
          We must enter that scope, to avoid finding member functions of the