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 36404


Hi,

a patchlet for a simple ICE on invalid. I also checked that the EDG front-end errors out in a similar way and exactly at the same lines both for the new testcase and the amended old one.

Regtested x86_64-linux. Ok for mainline?

Paolo.

///////////////////
/cp
2008-06-02  Paolo Carlini  <paolo.carlini@oracle.com>

        PR c++/36404
        * pt.c (push_template_decl_real): Consistently return error_mark_node
	on error.

/testsuite
2008-06-02  Paolo Carlini  <paolo.carlini@oracle.com>

        PR c++/36404
        * g++.dg/template/crash79.C: New.
	* g++.dg/other/pr28114.C: Adjust.	
Index: testsuite/g++.dg/other/pr28114.C
===================================================================
*** testsuite/g++.dg/other/pr28114.C	(revision 136271)
--- testsuite/g++.dg/other/pr28114.C	(working copy)
*************** template<int> void foo(struct {}*); // {
*** 5,9 ****
  
  void bar()
  {
!   foo<0>(0); // { dg-error "" }
  }
--- 5,9 ----
  
  void bar()
  {
!   foo<0>(0);
  }
Index: testsuite/g++.dg/template/crash79.C
===================================================================
*** testsuite/g++.dg/template/crash79.C	(revision 0)
--- testsuite/g++.dg/template/crash79.C	(revision 0)
***************
*** 0 ****
--- 1,9 ----
+ // PR c++/36404
+ 
+ struct A
+ {
+   A(int);
+   template<int> enum { e }; // { dg-error "template" }
+ };
+ 
+ A a(A::e); // { dg-error "not a member" }
Index: cp/pt.c
===================================================================
*** cp/pt.c	(revision 136271)
--- cp/pt.c	(working copy)
*************** push_template_decl_real (tree decl, bool
*** 3791,3797 ****
  	member_template_p = true;
        if (TREE_CODE (decl) == TYPE_DECL
  	  && ANON_AGGRNAME_P (DECL_NAME (decl)))
! 	error ("template class without a name");
        else if (TREE_CODE (decl) == FUNCTION_DECL)
  	{
  	  if (DECL_DESTRUCTOR_P (decl))
--- 3791,3800 ----
  	member_template_p = true;
        if (TREE_CODE (decl) == TYPE_DECL
  	  && ANON_AGGRNAME_P (DECL_NAME (decl)))
! 	{
! 	  error ("template class without a name");
! 	  return error_mark_node;
! 	}
        else if (TREE_CODE (decl) == FUNCTION_DECL)
  	{
  	  if (DECL_DESTRUCTOR_P (decl))

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