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 30659


Hi,

tested x86_64-linux. Ok for mainline and 4_2-branch?

Paolo.

///////////////////
cp/
2007-09-21  Paolo Carlini  <pcarlini@suse.de>

	PR c++/30659
	* search.c (lookup_member): Check that xbasetype is non-NULL.

testsuite/
2007-09-21  Paolo Carlini  <pcarlini@suse.de>

	PR c++/30659
	* g++.dg/template/crash73.C: New.
Index: testsuite/g++.dg/template/crash73.C
===================================================================
*** testsuite/g++.dg/template/crash73.C	(revision 0)
--- testsuite/g++.dg/template/crash73.C	(revision 0)
***************
*** 0 ****
--- 1,3 ----
+ // PR c++/30659
+ 
+ extern "C" template A<char> foo(); // { dg-error "forbids|template|expected" }
Index: cp/search.c
===================================================================
*** cp/search.c	(revision 128637)
--- cp/search.c	(working copy)
*************** lookup_member (tree xbasetype, tree name
*** 1204,1209 ****
--- 1204,1212 ----
  
    gcc_assert (TREE_CODE (name) == IDENTIFIER_NODE);
  
+   if (!xbasetype)
+     return NULL_TREE;
+ 
    if (TREE_CODE (xbasetype) == TREE_BINFO)
      {
        type = BINFO_TYPE (xbasetype);
*************** lookup_member (tree xbasetype, tree name
*** 1214,1220 ****
        if (!IS_AGGR_TYPE_CODE (TREE_CODE (xbasetype)))
  	return NULL_TREE;
        type = xbasetype;
-       xbasetype = NULL_TREE;
      }
  
    type = complete_type (type);
--- 1217,1222 ----

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