PR c++/5116, c++/764 reversion
authorNathan Sidwell <nathan@codesourcery.com>
Wed, 2 Jan 2002 15:17:07 +0000 (15:17 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Wed, 2 Jan 2002 15:17:07 +0000 (15:17 +0000)
cp:
PR c++/5116, c++/764 reversion
* call.c (build_new_op): Revert the instantiations. They are
incorrect.
testsuite:
* g++.dg/template/friend2.C: Remove as patch is reverted.

From-SVN: r48474

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/friend2.C [deleted file]

index e74dc1542c079a0793856d4749493f12e9f33b19..a5f99e6076cec6116e6cb8ae64bab9c6b35d6c82 100644 (file)
@@ -1,3 +1,9 @@
+2002-01-02  Nathan Sidwell  <nathan@codesourcery.com>
+
+       PR c++/5116, c++/764 reversion
+       * call.c (build_new_op): Revert the instantiations. They are
+       incorrect.
+       
 2002-01-02  Nathan Sidwell  <nathan@codesourcery.com>
 
        PR c++/5089
index 6672119d54c65003551d3d6e0be38ac2d8047487..190ddac20d883154ce14d3306689787ad3278d20 100644 (file)
@@ -3247,10 +3247,6 @@ build_new_op (code, flags, arg1, arg2, arg3)
   if (TREE_CODE (arg1) == OFFSET_REF)
     arg1 = resolve_offset_ref (arg1);
   arg1 = convert_from_reference (arg1);
-  if (CLASS_TYPE_P (TREE_TYPE (arg1))
-      && CLASSTYPE_TEMPLATE_INSTANTIATION (TREE_TYPE (arg1)))
-    /* Make sure the template type is instantiated now.  */
-    instantiate_class_template (TYPE_MAIN_VARIANT (TREE_TYPE (arg1)));
   
   switch (code)
     {
@@ -3273,18 +3269,12 @@ build_new_op (code, flags, arg1, arg2, arg3)
       if (TREE_CODE (arg2) == OFFSET_REF)
        arg2 = resolve_offset_ref (arg2);
       arg2 = convert_from_reference (arg2);
-      if (CLASS_TYPE_P (TREE_TYPE (arg2))
-         && CLASSTYPE_TEMPLATE_INSTANTIATION (TREE_TYPE (arg2)))
-       instantiate_class_template (TYPE_MAIN_VARIANT (TREE_TYPE (arg2)));
     }
   if (arg3)
     {
       if (TREE_CODE (arg3) == OFFSET_REF)
        arg3 = resolve_offset_ref (arg3);
       arg3 = convert_from_reference (arg3);
-      if (CLASS_TYPE_P (TREE_TYPE (arg3))
-         && CLASSTYPE_TEMPLATE_INSTANTIATION (TREE_TYPE (arg3)))
-       instantiate_class_template (TYPE_MAIN_VARIANT (TREE_TYPE (arg3)));
     }
   
   if (code == COND_EXPR)
index 7e2fa439c13b5e1d9129fba8475bb882071002bc..d225074a5b7b627002e35556c5fac1cf59f85cbb 100644 (file)
@@ -1,5 +1,7 @@
 2002-01-02  Nathan Sidwell  <nathan@codesourcery.com>
 
+       * g++.dg/template/friend2.C: Remove as patch is reverted.
+
        * g++.dg/warn/oldcast1.C: New test.
 
        * g++.dg/template/ptrmem1.C: New test.
diff --git a/gcc/testsuite/g++.dg/template/friend2.C b/gcc/testsuite/g++.dg/template/friend2.C
deleted file mode 100644 (file)
index de07518..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-// { dg-do run }
-
-// Copyright (C) 2001 Free Software Foundation, Inc.
-// Contributed by Nathan Sidwell 31 Dec 2001 <nathan@codesourcery.com>
-
-// PR 5116 Failed to find friend in overload resolution
-
-int wrong;
-int right;
-
-struct Printer 
-{
-  Printer &operator<< (bool a)
-  {
-    wrong++;
-    
-    return *this;
-  }
-  
-};
-
-struct Buggy {};
-
-template <typename T> struct Handle
-{
-  Handle(T* p) {}
-  
-  operator bool() const { return true; }
-  
-  friend Printer& operator<<(Printer& ostr, const Handle& r)
-  {
-    right++;
-
-    return ostr;
-    
-  }
-};
-
-typedef Handle<Buggy>     Buggy_h;
-
-Printer out;
-
-bool cmp (const Buggy_h& b1, const Buggy_h& b2)
-{
-  out << b1 << b2;
-  return false;
-}
-
-int main()
-{
-  Buggy o;
-  
-  cmp (&o, &o);
-
-  if (wrong)
-    return 1;
-  if (right != 2)
-    return 2;
-  return 0;
-}