call.c (build_method_call): Handle non-scoped destructors, too.
authorJason Merrill <jason@yorick.cygnus.com>
Mon, 30 Mar 1998 09:07:34 +0000 (09:07 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 30 Mar 1998 09:07:34 +0000 (04:07 -0500)
* call.c (build_method_call): Handle non-scoped destructors, too.
* pt.c (tsubst_copy): Likewise.
* pt.c (print_template_context): Split out...
(push_tinst_level): ...from here.
* friend.c (is_friend): Don't pass a type to decl_function_context.
* typeck.c (convert_for_initialization): Always hand off
conversions to class type.

From-SVN: r18908

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/friend.c
gcc/cp/pt.c
gcc/cp/typeck.c

index 62780a4673719db424d9be9fcf8bdea62bbdf799..d2f56656de749916bfe11ce99eae60fc92a777a0 100644 (file)
@@ -1,3 +1,16 @@
+Mon Mar 30 08:55:42 1998  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * call.c (build_method_call): Handle non-scoped destructors, too.
+       * pt.c (tsubst_copy): Likewise.
+
+       * pt.c (print_template_context): Split out...
+       (push_tinst_level): ...from here.
+
+       * friend.c (is_friend): Don't pass a type to decl_function_context.
+
+       * typeck.c (convert_for_initialization): Always hand off
+       conversions to class type.
+
 Sun Mar 29 20:01:59 1998  Jason Merrill  <jason@yorick.cygnus.com>
 
        * friend.c (is_friend): Local classes have the same access as the
index 6e569954933f8d845c55b2ba2ecb9b14e4588d15..d066a582ad8b58dabc294ad2cae89fa86c264828 100644 (file)
@@ -571,8 +571,9 @@ build_method_call (instance, name, parms, basetype_path, flags)
     {
       if (TREE_CODE (name) == BIT_NOT_EXPR)
        {
-         tree type = get_aggr_from_typedef (TREE_OPERAND (name, 0), 1);
-         name = build_min_nt (BIT_NOT_EXPR, type);
+         tree type = get_aggr_from_typedef (TREE_OPERAND (name, 0), 0);
+         if (type)
+           name = build_min_nt (BIT_NOT_EXPR, type);
        }
 
       return build_min_nt (METHOD_CALL_EXPR, name, instance, parms, NULL_TREE);
index d0e6fefbff828cd93ef1d9cbfcbeb7f86fc6212b..304936a82ac6ff446b127a8e9c9d47e92588247d 100644 (file)
@@ -49,7 +49,8 @@ is_friend (type, supplicant)
   declp = (TREE_CODE_CLASS (TREE_CODE (supplicant)) == 'd');
 
   /* Local classes have the same access as the enclosing function.  */
-  context = hack_decl_function_context (supplicant);
+  context = declp ? supplicant : TYPE_MAIN_DECL (supplicant);
+  context = hack_decl_function_context (context);
   if (context)
     {
       supplicant = context;
index 893ef2f5b457dda0d23e885347a6f7d42d918d0a..4f87928cfc19a473e9e9720846ac3c96625be770 100644 (file)
@@ -3133,6 +3133,28 @@ extern int max_tinst_depth;
 int depth_reached = 0;
 #endif
 
+/* Print out all the template instantiations that we are currently
+   working on.  */
+
+void
+print_template_context ()
+{
+  struct tinst_level *p = current_tinst_level;
+  int line = lineno;
+  char *file = input_filename;
+
+  for (; p; p = p->next)
+    {
+      cp_error ("  instantiated from `%D'", p->decl);
+      lineno = p->line;
+      input_filename = p->file;
+    }
+  error ("  instantiated from here");
+
+  lineno = line;
+  input_filename = file;
+}
+
 static int
 push_tinst_level (d)
      tree d;
@@ -3141,10 +3163,6 @@ push_tinst_level (d)
 
   if (tinst_depth >= max_tinst_depth)
     {
-      struct tinst_level *p = current_tinst_level;
-      int line = lineno;
-      char *file = input_filename;
-
       /* If the instantiation in question still has unbound template parms,
         we don't really care if we can't instantiate it, so just return.
          This happens with base instantiation for implicit `typename'.  */
@@ -3156,16 +3174,7 @@ push_tinst_level (d)
       error (" (use -ftemplate-depth-NN to increase the maximum)");
       cp_error ("  instantiating `%D'", d);
 
-      for (; p; p = p->next)
-       {
-         cp_error ("  instantiated from `%D'", p->decl);
-         lineno = p->line;
-         input_filename = p->file;
-       }
-      error ("  instantiated from here");
-
-      lineno = line;
-      input_filename = file;
+      print_template_context ();
 
       return 0;
     }
@@ -4836,7 +4845,9 @@ tsubst_copy (t, args, in_decl)
        if (TREE_CODE (name) == BIT_NOT_EXPR)
          {
            name = tsubst_copy (TREE_OPERAND (name, 0), args, in_decl);
-           name = build1 (BIT_NOT_EXPR, NULL_TREE, TYPE_MAIN_VARIANT (name));
+           if (TREE_CODE (name) != IDENTIFIER_NODE)
+             name = TYPE_MAIN_VARIANT (name);
+           name = build1 (BIT_NOT_EXPR, NULL_TREE, name);
          }
        else if (TREE_CODE (name) == SCOPE_REF
                 && TREE_CODE (TREE_OPERAND (name, 1)) == BIT_NOT_EXPR)
index 9786dfb59c26dde8760b69bd89be409332ce001e..dfcda9ad21c794675f394495d7b8fad62ee73b74 100644 (file)
@@ -7031,8 +7031,7 @@ convert_for_initialization (exp, type, rhs, flags, errtype, fndecl, parmnum)
       && (IS_SIGNATURE_POINTER (type) || IS_SIGNATURE_REFERENCE (type)))
     return build_signature_pointer_constructor (type, rhs);
 
-  if (IS_AGGR_TYPE (type)
-      && (TYPE_NEEDS_CONSTRUCTING (type) || TREE_HAS_CONSTRUCTOR (rhs)))
+  if (IS_AGGR_TYPE (type))
     return ocp_convert (type, rhs, CONV_IMPLICIT|CONV_FORCE_TEMP, flags);
 
   if (type == TREE_TYPE (rhs))