semantics.c (finish_object_call_expr): Revert previous change.
authorMark Mitchell <mark@markmitchell.com>
Thu, 16 Jul 1998 23:38:43 +0000 (23:38 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Thu, 16 Jul 1998 23:38:43 +0000 (23:38 +0000)
1998-07-16  Mark Mitchell  <mark@markmitchell.com>
* semantics.c (finish_object_call_expr): Revert previous change.
* call.c (build_new_method_call): Likewise.  Instead, convert
TYPE_DECLs to IDENTIFIERs here, in the presence of templates.

From-SVN: r21240

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/semantics.c
gcc/testsuite/g++.old-deja/g++.pt/call1.C

index 20e6653c630ddd32374aff7f3920f9533d51ac9d..62d2753af9a8552afdba5623235430bcdc161522 100644 (file)
@@ -1,3 +1,9 @@
+1998-07-16  Mark Mitchell  <mark@markmitchell.com>
+
+       * semantics.c (finish_object_call_expr): Revert previous change.
+       * call.c (build_new_method_call): Likewise.  Instead, convert
+       TYPE_DECLs to IDENTIFIERs here, in the presence of templates.
+
 1998-07-16  Jason Merrill  <jason@yorick.cygnus.com>
 
        * decl.c (qualify_lookup): Handle templates.
index 7a8719153cb547806830129b0aa78f29ecb2e776..3e11a741fa5ccdf5329dd2c75d00bfe56cf54a97 100644 (file)
@@ -3552,12 +3552,6 @@ build_new_method_call (instance, name, args, basetype_path, flags)
       template_only = 1;
     }
 
-  if (TREE_CODE (name) == TYPE_DECL)
-    {
-      cp_error ("calling type `%T' like a method", name);
-      return error_mark_node;
-    }
-    
   /* If there is an extra argument for controlling virtual bases,
      remove it for error reporting.  */
   if (flags & LOOKUP_HAS_IN_CHARGE)
index cae0b6734661ac9c0625de88f40a089a7d92934d..3459d1a80fcbdceb538b4be3e47a78036cd587a9 100644 (file)
@@ -922,6 +922,25 @@ finish_object_call_expr (fn, object, args)
   tree real_fn = build_component_ref (object, fn, NULL_TREE, 1);
   return finish_call_expr (real_fn, args);
 #else
+  if (TREE_CODE (fn) == TYPE_DECL)
+    {
+      if (processing_template_decl)
+       /* This can happen on code like:
+
+          class X;
+          template <class T> void f(T t) {
+            t.X();
+          }  
+
+          We just grab the underlying IDENTIFIER.  */
+       fn = DECL_NAME (fn);
+      else
+       {
+         cp_error ("calling type `%T' like a method", fn);
+         return error_mark_node;
+       }
+    }
+
   return build_method_call (object, fn, args, NULL_TREE, LOOKUP_NORMAL);
 #endif
 }
index 257d5473295fbd6883c9f7550c6ebdcc3ecdf10a..b9836bbcc5a897ff6abb18cf924dfa3ba093d660 100644 (file)
@@ -11,3 +11,5 @@ for_each(const Field& p, IsCompressed, C)
 {
   return p.IsCompressed();
 }
+
+template bool for_each<int>(const Field& p, IsCompressed, int);