From: Mark Mitchell Date: Wed, 4 Mar 1998 11:33:01 +0000 (+0000) Subject: pt.c (finish_member_template_decl): Deal more gracefully with invalid declarations. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a1da6cbacfac48657e23fe42e44ee8bb635314f3;p=gcc.git pt.c (finish_member_template_decl): Deal more gracefully with invalid declarations. * pt.c (finish_member_template_decl): Deal more gracefully with invalid declarations. From-SVN: r18399 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 54b45e1b30b..01408910240 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +Wed Mar 4 11:28:08 1998 Mark Mitchell + + * pt.c (finish_member_template_decl): Deal more gracefully with + invalid declarations. + Tue Mar 3 01:38:17 1998 Jason Merrill * call.c, class.c, cp-tree.h, cvt.c, decl.c, init.c, lex.c, diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index dcc137396dc..f4678972e58 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -118,14 +118,21 @@ finish_member_template_decl (template_parameters, decl) } return NULL_TREE; } - else if (DECL_TEMPLATE_INFO (decl) && - !DECL_TEMPLATE_SPECIALIZATION (decl)) + else if (DECL_TEMPLATE_INFO (decl)) { - check_member_template (DECL_TI_TEMPLATE (decl)); - return DECL_TI_TEMPLATE (decl); - } + if (!DECL_TEMPLATE_SPECIALIZATION (decl)) + { + check_member_template (DECL_TI_TEMPLATE (decl)); + return DECL_TI_TEMPLATE (decl); + } + else + return decl; + } + else + cp_error ("invalid member template declaration `%D'", decl); + - return decl; + return error_mark_node; } /* Returns the template nesting level of the indicated class TYPE. diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp71.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp71.C new file mode 100644 index 00000000000..f3b72be28cc --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp71.C @@ -0,0 +1,6 @@ +// Build don't link: + +class A +{ + templateT epsilon; // ERROR - invalid member template +}; // ERROR - the compiler crashes here