This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[C++ Patch] PR 32561


Hi,

tested x86_64-linux. Ok for mainline?

Paolo.

///////////////////
/cp
2007-07-13  Paolo Carlini  <pcarlini@suse.de>

	PR c++/32561
	* decl.c (redeclaration_error_message): Call DECL_ANON_UNION_VAR_P
	only on VAR_DECL.

/testsuite
2007-07-13  Paolo Carlini  <pcarlini@suse.de>

	PR c++/32561
	* g++.dg/template/crash67.C: New.
Index: testsuite/g++.dg/template/crash67.C
===================================================================
*** testsuite/g++.dg/template/crash67.C	(revision 0)
--- testsuite/g++.dg/template/crash67.C	(revision 0)
***************
*** 0 ****
--- 1,3 ----
+ // PR c++/32561
+ 
+ template<int N, int N> struct A; // { dg-error "redefinition|declared" } 
Index: cp/decl.c
===================================================================
*** cp/decl.c	(revision 126592)
--- cp/decl.c	(working copy)
*************** redeclaration_error_message (tree newdec
*** 2195,2202 ****
  	   union { int i; };
  
  	   is invalid.  */
!       if (DECL_ANON_UNION_VAR_P (newdecl)
! 	  || DECL_ANON_UNION_VAR_P (olddecl))
  	return "redeclaration of %q#D";
        /* If at least one declaration is a reference, there is no
  	 conflict.  For example:
--- 2195,2202 ----
  	   union { int i; };
  
  	   is invalid.  */
!       if ((TREE_CODE (newdecl) == VAR_DECL && DECL_ANON_UNION_VAR_P (newdecl))
! 	  || (TREE_CODE (olddecl) == VAR_DECL && DECL_ANON_UNION_VAR_P (olddecl)))
  	return "redeclaration of %q#D";
        /* If at least one declaration is a reference, there is no
  	 conflict.  For example:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]