Blame SOURCES/gcc32-rh156185.patch

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