call.c (maybe_handle_ref_bind): Copy ICS_USER_FLAG and ICS_BAD_FLAG.
authorJakub Jelinek <jakub@redhat.com>
Fri, 20 Apr 2001 08:17:19 +0000 (10:17 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 20 Apr 2001 08:17:19 +0000 (10:17 +0200)
* call.c (maybe_handle_ref_bind): Copy ICS_USER_FLAG and
ICS_BAD_FLAG.

* g++.old-deja/g++.other/overload14.C: New test.

From-SVN: r41448

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.old-deja/g++.other/overload14.C [new file with mode: 0644]

index 24af2b4c4f91804b58cac716afc76362912be52e..16a03dcf18c65952969a9b20596c12a0b408fc1b 100644 (file)
@@ -1,3 +1,8 @@
+2001-04-20  Jakub Jelinek  <jakub@redhat.com>
+
+       * call.c (maybe_handle_ref_bind): Copy ICS_USER_FLAG and
+       ICS_BAD_FLAG.
+
 2001-04-20  Jakub Jelinek  <jakub@redhat.com>
 
        * search.c (lookup_field_r): If looking for type and non-TYPE_DECL
index 548bd008fe69bf3336d713e1748f8911d7ab36f7..4d4d033c1303380189231ed1c69afe8fb65d65d0 100644 (file)
@@ -4741,11 +4741,14 @@ maybe_handle_ref_bind (ics, target_type)
 {
   if (TREE_CODE (*ics) == REF_BIND)
     {
+      tree old_ics = *ics;
       *target_type = TREE_TYPE (TREE_TYPE (*ics));
       *ics = TREE_OPERAND (*ics, 0);
+      ICS_USER_FLAG (*ics) = ICS_USER_FLAG (old_ics);
+      ICS_BAD_FLAG (*ics) = ICS_BAD_FLAG (old_ics);
       return 1;
     }
-  
+
   return 0;
 }
 
index 1ceeb4083c055a64eadcebf2484d494033e2e19c..2a97b4e68322a2cdc9444b43ce7ca3c2f845157f 100644 (file)
@@ -1,3 +1,7 @@
+2001-04-20  Jakub Jelinek  <jakub@redhat.com>
+
+       * g++.old-deja/g++.other/overload14.C: New test.
+
 2001-04-20  Jakub Jelinek  <jakub@redhat.com>
 
        * g++.old-deja/g++.other/lookup23.C: New test.
diff --git a/gcc/testsuite/g++.old-deja/g++.other/overload14.C b/gcc/testsuite/g++.old-deja/g++.other/overload14.C
new file mode 100644 (file)
index 0000000..8938ef1
--- /dev/null
@@ -0,0 +1,31 @@
+extern "C" void abort();
+
+struct A {
+  typedef double (&B);
+  typedef const double (&C);
+
+  A() { }
+
+  operator C () const;
+  operator B ();
+};
+
+static const double d = 2.0;
+static double e = 3.0;
+
+A::operator A::C () const
+{
+  abort ();
+  return d;
+}
+
+A::operator A::B ()
+{
+  return e;
+}
+
+int main ()
+{
+  (A::C) A ();         // WARNING - 
+  return 0;
+}