This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ PATCH] Fix overloading ICE
- To: mark at codesourcery dot com, jason at redhat dot com
- Subject: [C++ PATCH] Fix overloading ICE
- From: Jakub Jelinek <jakub at redhat dot com>
- Date: Thu, 1 Feb 2001 14:53:42 +0100
- Cc: gcc-patches at gcc dot gnu dot org
- Reply-To: Jakub Jelinek <jakub at redhat dot com>
Hi!
The testcase below ICEs when build_over_call calls joust in order to issue
overloading warning. The same joust call succeeded soon before (well, with
the arguments exchanged), but then build_user_type_conversion_1 puts in
USER_CONV and sets ICS_USER_FLAG which is not seen by compare_ics though,
because maybe_handle_ref_bind does not propagate it. maybe_handle_ref_bind
used to copy these flags until Mark's 1999-07-22 change.
If you don't think this is a right solution, maybe compare_ics could save
the content of those flags before call to maybe_handle_ref_bind and the
ICS_RANK tests in compare_ics would have to be adapted.
Bootstrapped on i386-redhat-linux, no regressions.
Ok to commit?
2001-02-01 Jakub Jelinek <jakub@redhat.com>
* call.c (maybe_handle_ref_bind): Copy ICS_USER_FLAG and
ICS_BAD_FLAG.
* g++.old-deja/g++.other/overload14.C: New test.
--- gcc/cp/call.c.jj Sun Jan 28 12:36:36 2001
+++ gcc/cp/call.c Thu Feb 1 13:33:28 2001
@@ -4671,11 +4671,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;
}
--- gcc/testsuite/g++.old-deja/g++.other/overload14.C.jj Thu Feb 1 13:48:21 2001
+++ gcc/testsuite/g++.old-deja/g++.other/overload14.C Thu Feb 1 13:45:59 2001
@@ -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;
+}
Jakub