[patch] PR c++/20153, PR c++/22545: backport to 3.4 branch

Volker Reichelt reichelt@igpm.rwth-aachen.de
Thu Sep 1 09:11:00 GMT 2005


Here's the first batch of backports from mainline/4.0 branch to
the 3.4 branch.

Bootstrapped and regtested on i686-pc-linux-gnu.
Ok for the 3.4 branch?

Regards,
Volker



2005-09-01  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>

	Backport:

	2005-02-22  Mark Mitchell  <mark@codesourcery.com>
	PR c++/20153
	* decl2.c (build_anon_union_vars): Add type parameter.
	(finish_anon_union): Pass it.

	2005-07-28  Mark Mitchell  <mark@codesourcery.com>
	PR c++/22545
	* call.c (add_builtin_candidate): Adjust for changes in
	representation of pointer-to-member types.

===================================================================
--- gcc/gcc/cp/decl2.c	11 Oct 2004 14:42:36 -0000	1.695.4.10
+++ gcc/gcc/cp/decl2.c	31 Aug 2005 13:20:38 -0000
@@ -64,7 +64,6 @@ typedef struct priority_info_s {
 static void mark_vtable_entries (tree);
 static void grok_function_init (tree, tree);
 static bool maybe_emit_vtables (tree);
-static tree build_anon_union_vars (tree);
 static bool acceptable_java_type (tree);
 static tree start_objects (int, int);
 static void finish_objects (int, int, tree);
@@ -1131,14 +1130,13 @@ defer_fn (tree fn)
   VARRAY_PUSH_TREE (deferred_fns, fn);
 }
 
-/* Walks through the namespace- or function-scope anonymous union OBJECT,
-   building appropriate ALIAS_DECLs.  Returns one of the fields for use in
-   the mangled name.  */
+/* Walks through the namespace- or function-scope anonymous union
+   OBJECT, with the indicated TYPE, building appropriate ALIAS_DECLs.
+   Returns one of the fields for use in the mangled name.  */
 
 static tree
-build_anon_union_vars (tree object)
+build_anon_union_vars (tree type, tree object)
 {
-  tree type = TREE_TYPE (object);
   tree main_decl = NULL_TREE;
   tree field;
 
@@ -1185,7 +1183,7 @@ build_anon_union_vars (tree object)
 	  decl = pushdecl (decl);
 	}
       else if (ANON_AGGR_TYPE_P (TREE_TYPE (field)))
-	decl = build_anon_union_vars (ref);
+	decl = build_anon_union_vars (TREE_TYPE (field), ref);
       else
 	decl = 0;
 
@@ -1225,7 +1223,7 @@ finish_anon_union (tree anon_union_decl)
       return;
     }
 
-  main_decl = build_anon_union_vars (anon_union_decl);
+  main_decl = build_anon_union_vars (type, anon_union_decl);
   if (main_decl == NULL_TREE)
     {
       warning ("anonymous union with no members");
===================================================================
--- gcc/gcc/cp/call.c	2005/07/15 18:47:16	1.531.2.5
+++ gcc/gcc/cp/call.c	2005/07/28 19:02:22	1.531.2.6
@@ -1700,7 +1700,7 @@
 
 	  if (IS_AGGR_TYPE (c1) && DERIVED_FROM_P (c2, c1)
 	      && (TYPE_PTRMEMFUNC_P (type2)
-		  || is_complete (TREE_TYPE (TREE_TYPE (type2)))))
+		  || is_complete (TYPE_PTRMEM_POINTED_TO_TYPE (type2))))
 	    break;
 	}
       return;
===================================================================


2005-09-01  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>

	Backport:

	2005-02-22  Mark Mitchell  <mark@codesourcery.com>
	PR c++/20153
	* g++.dg/template/error17.C: New test.

	2005-07-28  Mark Mitchell  <mark@codesourcery.com>
	PR c++/22545
	* g++.dg/expr/ptrmem7.C: New test.

===================================================================
--- gcc/gcc/testsuite/g++.dg/template/error17.C
+++ gcc/gcc/testsuite/g++.dg/template/error17.C	2005-08-31 13:12:35 +0000
@@ -0,0 +1,8 @@
+// PR c++/20153
+
+template <typename T>
+void
+foo()
+{
+  union { struct { }; }; // { dg-error "" }
+}
===================================================================
--- gcc/gcc/testsuite/g++.dg/expr/ptrmem7.C
+++ gcc/gcc/testsuite/g++.dg/expr/ptrmem7.C	2005-08-31 12:56:17 +0000
@@ -0,0 +1,21 @@
+// PR c++/22545
+
+struct A {
+  int member;
+  A() : member(13) {}
+};
+
+A a;
+
+struct B {
+  operator A*() { return &a; }
+};
+
+B b;
+
+int A::* member_pntr = &A::member;
+
+int main()
+{
+  return b ->* member_pntr;
+}
===================================================================




More information about the Gcc-patches mailing list