Commit b17c40be by Paolo Carlini Committed by Paolo Carlini

re PR c++/37650 (ICE with broken default template parameter)

/cp
2008-10-14  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/37650
	* pt.c (push_template_decl_real): Check that current_template_parms
	is not null.
	(process_partial_specialization): Assert current_template_parms not
	null.

/testsuite
2008-10-14  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/37650
	* g++.dg/template/crash83.C: New.

From-SVN: r141115
parent c841843f
2008-10-14 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/37650
* pt.c (push_template_decl_real): Check that current_template_parms
is not null.
(process_partial_specialization): Assert current_template_parms not
null.
2008-10-13 Doug Evans <dje@google.com> 2008-10-13 Doug Evans <dje@google.com>
* cp-tree.h (DECL_MAIN_P): Fix parentheses around expression. * cp-tree.h (DECL_MAIN_P): Fix parentheses around expression.
......
...@@ -3292,15 +3292,20 @@ process_partial_specialization (tree decl) ...@@ -3292,15 +3292,20 @@ process_partial_specialization (tree decl)
tree maintmpl = CLASSTYPE_TI_TEMPLATE (type); tree maintmpl = CLASSTYPE_TI_TEMPLATE (type);
tree specargs = CLASSTYPE_TI_ARGS (type); tree specargs = CLASSTYPE_TI_ARGS (type);
tree inner_args = INNERMOST_TEMPLATE_ARGS (specargs); tree inner_args = INNERMOST_TEMPLATE_ARGS (specargs);
tree inner_parms = INNERMOST_TEMPLATE_PARMS (current_template_parms);
tree main_inner_parms = DECL_INNERMOST_TEMPLATE_PARMS (maintmpl); tree main_inner_parms = DECL_INNERMOST_TEMPLATE_PARMS (maintmpl);
tree inner_parms;
int nargs = TREE_VEC_LENGTH (inner_args); int nargs = TREE_VEC_LENGTH (inner_args);
int ntparms = TREE_VEC_LENGTH (inner_parms); int ntparms;
int i; int i;
int did_error_intro = 0; int did_error_intro = 0;
struct template_parm_data tpd; struct template_parm_data tpd;
struct template_parm_data tpd2; struct template_parm_data tpd2;
gcc_assert (current_template_parms);
inner_parms = INNERMOST_TEMPLATE_PARMS (current_template_parms);
ntparms = TREE_VEC_LENGTH (inner_parms);
/* We check that each of the template parameters given in the /* We check that each of the template parameters given in the
partial specialization is used in the argument list to the partial specialization is used in the argument list to the
specialization. For example: specialization. For example:
...@@ -3749,8 +3754,8 @@ push_template_decl_real (tree decl, bool is_friend) ...@@ -3749,8 +3754,8 @@ push_template_decl_real (tree decl, bool is_friend)
[temp.mem]. */ [temp.mem]. */
bool member_template_p = false; bool member_template_p = false;
if (decl == error_mark_node) if (decl == error_mark_node || !current_template_parms)
return decl; return error_mark_node;
/* See if this is a partial specialization. */ /* See if this is a partial specialization. */
is_partial = (DECL_IMPLICIT_TYPEDEF_P (decl) is_partial = (DECL_IMPLICIT_TYPEDEF_P (decl)
......
2008-10-14 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/37650
* g++.dg/template/crash83.C: New.
2008-10-14 Douglas Gregor <doug.gregor@gmail.com> 2008-10-14 Douglas Gregor <doug.gregor@gmail.com>
PR c++/37553 PR c++/37553
......
// PR c++/37650
template<int> struct A {};
template<typename = class A<0>: > struct B {}; // { dg-error "explicit specialization|expected" }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment