Blame SOURCES/gcc32-rh156185.patch

6f1b0c
2005-09-26  Alexandre Oliva  <aoliva@redhat.com>
6f1b0c
6f1b0c
	2002-08-13  Mark Mitchell  <mark@codesourcery.com>
6f1b0c
	* decl.c (pushdecl_class_level): Honor requests to bind names to
6f1b0c
	OVERLOADs.
6f1b0c
6f1b0c
2005-09-26  Alexandre Oliva  <aoliva@redhat.com>
6f1b0c
6f1b0c
	* g++.dg/lookup/overload1.C: New.
6f1b0c
6f1b0c
--- gcc/cp/decl.c.orig
6f1b0c
+++ gcc/cp/decl.c
6f1b0c
@@ -4369,8 +4369,9 @@ pushdecl_class_level (x)
6f1b0c
   register tree name;
6f1b0c
 
6f1b0c
   if (TREE_CODE (x) == OVERLOAD)
6f1b0c
-    x = OVL_CURRENT (x);
6f1b0c
-  name = DECL_NAME (x);
6f1b0c
+    name = DECL_NAME (OVL_CURRENT (x));
6f1b0c
+  else
6f1b0c
+    name = DECL_NAME (x);
6f1b0c
 
6f1b0c
   if (name)
6f1b0c
     {
6f1b0c
--- gcc/testsuite/g++.dg/lookup/overload1.C
6f1b0c
+++ gcc/testsuite/g++.dg/lookup/overload1.C
6f1b0c
@@ -0,0 +1,24 @@
6f1b0c
+// { dg-do compile }
6f1b0c
+
6f1b0c
+// This used to crash expanding the initializer, because instead of
6f1b0c
+// pushing the OVERLOAD containing template and function decls, we'd
6f1b0c
+// push only the first member of the overload list.  The code below is
6f1b0c
+// from the bug report at
6f1b0c
+// https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=156185
6f1b0c
+
6f1b0c
+struct C {
6f1b0c
+  template< class N >
6f1b0c
+  static C *newInstance() { return new N; };
6f1b0c
+};
6f1b0c
+
6f1b0c
+typedef C*( *CreateFunc)();
6f1b0c
+
6f1b0c
+struct B {
6f1b0c
+  B( CreateFunc _createf ){}
6f1b0c
+};
6f1b0c
+
6f1b0c
+struct A : C {
6f1b0c
+  static B b;
6f1b0c
+};
6f1b0c
+
6f1b0c
+B A::b( newInstance );