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 19667


This patch fixes a recently-introduced ICE-on-invalid in the C++ front
end; we were missing a check for NULL.

Tested on x86_64-unknown-linux-gnu, applied on the mainline.

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

2005-01-28  Mark Mitchell  <mark@codesourcery.com>

	PR c++/19667
	* g++.dg/template/crash32.C: New test.

2005-01-28  Mark Mitchell  <mark@codesourcery.com>

	PR c++/19667
	* pt.c (redeclare_class_template): Robustify.

Index: cp/pt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/pt.c,v
retrieving revision 1.969
diff -c -5 -p -r1.969 pt.c
*** cp/pt.c	27 Jan 2005 07:32:24 -0000	1.969
--- cp/pt.c	29 Jan 2005 00:46:13 -0000
*************** redeclare_class_template (tree type, tre
*** 3234,3243 ****
--- 3234,3250 ----
      /* The type is nested in some template class.  Nothing to worry
         about here; there are no new template parameters for the nested
         type.  */
      return;
  
+   if (!parms)
+     {
+       error ("template specifiers not specified in declaration of %qD",
+ 	     tmpl);
+       return;
+     }
+ 
    parms = INNERMOST_TEMPLATE_PARMS (parms);
    tmpl_parms = DECL_INNERMOST_TEMPLATE_PARMS (tmpl);
  
    if (TREE_VEC_LENGTH (parms) != TREE_VEC_LENGTH (tmpl_parms))
      {
Index: testsuite/g++.dg/template/crash32.C
===================================================================
RCS file: testsuite/g++.dg/template/crash32.C
diff -N testsuite/g++.dg/template/crash32.C
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/template/crash32.C	29 Jan 2005 00:46:13 -0000
***************
*** 0 ****
--- 1,9 ----
+ // PR c++/19667
+ 
+ struct integral_constant { };
+ 
+ template<typename _Tp>
+ struct is_function : public integral_constant { }; // { dg-error "previous" }
+ 
+ template<>
+ struct is_function : public integral_constant { }; // { dg-error "" }


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