[PATCH] [C++] Fix C++/13507

Andrew Pinski pinskia@physics.uc.edu
Tue Dec 30 09:42:00 GMT 2003


This patch fixes PR C++/13507.  The problem is that the type for the 
decl is shared with other decls.  I made sure that I did not brake the 
other PR which the patches which causes this work.
This should get the right semantics which are needed for c++ and 
builtins.

Bootstrapped on powerpc-apple-darwin7.2.0 with no regressions.
Ok for the mainline and 3.3?

ChangeLog:

	* decl.c: When setting the type of an anticipated
	declaration, merge the existing type attributes
	and copy TYPE_RAISES_EXCEPTIONS instead of using
	the new type.


Patch:
Index: decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.1169
diff -u -p -r1.1169 decl.c
--- decl.c	29 Dec 2003 02:42:16 -0000	1.1169
+++ decl.c	30 Dec 2003 06:49:29 -0000
@@ -1262,10 +1262,12 @@ duplicate_decls (tree newdecl, tree oldd
  	 for anticipated built-ins, for exception lists, etc...  */
        else if (DECL_ANTICIPATED (olddecl))
  	{
-	  TYPE_ATTRIBUTES (TREE_TYPE (newdecl))
+	  TYPE_ATTRIBUTES (TREE_TYPE (olddecl))
  	    = (*targetm.merge_type_attributes) (TREE_TYPE (olddecl),
  						TREE_TYPE (newdecl));
-	  TREE_TYPE (olddecl) = TREE_TYPE (newdecl);
+
+	  TYPE_RAISES_EXCEPTIONS (TREE_TYPE (olddecl))
+            = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (newdecl));
  	}

        /* Whether or not the builtin can throw exceptions has no



More information about the Gcc-patches mailing list