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 for c++/39054


We don't seem to be prepared to deal with BIT_NOT_EXPR of error_mark_node, so let's just forget about the destructor bit if we run into a parse error.

Tested x86_64-pc-linux-gnu, applying to trunk, will apply to 4.3 after testing.
2009-02-02  Jason Merrill  <jason@redhat.com>

	PR c++/39054
	* parser.c (cp_parser_unqualified_id): Don't wrap error_mark_node 
	in BIT_NOT_EXPR.
	* g++.dg/parse/dtor14.C: New test.

Index: cp/parser.c
===================================================================
*** cp/parser.c	(revision 143875)
--- cp/parser.c	(working copy)
*************** cp_parser_unqualified_id (cp_parser* par
*** 3896,3902 ****
  		/* We couldn't find a type with this name, so just accept
  		   it and check for a match at instantiation time.  */
  		type_decl = cp_parser_identifier (parser);
! 		return build_nt (BIT_NOT_EXPR, type_decl);
  	      }
  	  }
  	/* If an error occurred, assume that the name of the
--- 3896,3904 ----
  		/* We couldn't find a type with this name, so just accept
  		   it and check for a match at instantiation time.  */
  		type_decl = cp_parser_identifier (parser);
! 		if (type_decl != error_mark_node)
! 		  type_decl = build_nt (BIT_NOT_EXPR, type_decl);
! 		return type_decl;
  	      }
  	  }
  	/* If an error occurred, assume that the name of the
Index: testsuite/g++.dg/parse/dtor14.C
===================================================================
*** testsuite/g++.dg/parse/dtor14.C	(revision 0)
--- testsuite/g++.dg/parse/dtor14.C	(revision 0)
***************
*** 0 ****
--- 1,8 ----
+ // PR c++/39054
+ 
+ struct A {};
+ 
+ template<typename> void foo()
+ { 
+   A().~int();			// { dg-error "expected" }
+ }

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