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] |
This bug is an ICE on an invalid template declaration in cp_finish_decl which can be shown in the following testcase:
struct A { template<int> void foo(X); };
The attached patch fixes by changing check_var_type to set the return type to error_mark_node rather than integer_type_node. This can then be detected in grokdeclarator by checking the returned value from check_var_type and itself returning error_mark_node if this is what was returned.
These two changes aren't enough to fix the ICE by themselves which is why the third hunk to start_decl is required. Together these three small changes fix the ICE.
Bootstrapped and regression tested on i686-pc-linux-gnu with no new failures, ok for mainline?
Cheers, Lee.
PR c++/27961 * decl.c (start_decl): Return error_mark_node if a function is initialized like a variable. (check_var_type): If a variable of field is declared void, set the type to error_mark_node. (grokdeclarator): Check the return type of check_var_type. * class.c (finish_struct_1): Robustify.
PR c++/27961 * g++.dg/template/crash58.C: New test. * g++.dg/other/large-size-array.C: Adjust error markers. * g++.dg/parse/crash27.C: Likewise. * g++.dg/template/crash1.C: Likewise.
Attachment:
pr27961.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |