From fd9852dfcd30f19bbf873debfaacbc454f8749a4 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Tue, 19 Oct 2010 22:58:11 +0000 Subject: [PATCH] re PR c++/46046 (internal compiler error with SFINAE expression in a template inside a template) /cp 2010-10-19 Paolo Carlini PR c++/46046 * pt.c (add_to_template_args): Check extra_args for error_mark_node. (coerce_template_parms): Likewise for args. /testsuite 2010-10-19 Paolo Carlini PR c++/46046 * g++.dg/template/crash104.C: New. From-SVN: r165708 --- gcc/cp/ChangeLog | 63 +++++++++++++----------- gcc/cp/pt.c | 5 +- gcc/testsuite/ChangeLog | 31 +++++++----- gcc/testsuite/g++.dg/template/crash104.C | 26 ++++++++++ 4 files changed, 83 insertions(+), 42 deletions(-) create mode 100644 gcc/testsuite/g++.dg/template/crash104.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5447b4525ba..8a084dfe9ae 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2010-10-19 Paolo Carlini + + PR c++/46046 + * pt.c (add_to_template_args): Check extra_args for error_mark_node. + (coerce_template_parms): Likewise for args. + 2010-10-18 Nicola Pero Implemented parsing @synthesize and @dynamic for Objective-C++. @@ -6,15 +12,15 @@ (cp_parser_objc_at_dynamic_declaration): New. (cp_parser_objc_at_synthesize_declaration): New. -2010-10-18 Nicola Pero +2010-10-18 Nicola Pero * parser.c (cp_parser_objc_identifier_list): Check the return value of cp_parser_identifier and react if it is error_mark_node. 2010-10-18 Nicola Pero - + Merge from apple/trunk branch on FSF servers. - + 2005-03-01 Fariborz Jahanian Radar 4451818 @@ -27,7 +33,7 @@ Radar 4330422 * typeck.c (comp_ptr_ttypes_real): Remove the hack. un-volatize the artiificially 'volatized' type before doing pointer comparison. - + 2010-10-18 Jakub Jelinek PR c/46015 @@ -35,7 +41,7 @@ goto destination. 2010-10-17 Nicola Pero - + Merge from apple/trunk branch on FSF servers. 2006-04-19 Fariborz Jahanian @@ -43,20 +49,20 @@ Radar 4516785 * parser.c (cp_parser_simple_type_specifier): Don't lookup for objc object types if type is scope qualified. - + 2010-10-17 Nicola Pero - + Merge from apple/trunk branch on FSF servers. - + 2006-03-27 Fariborz Jahanian Radar 4133425 * lex.c (unqualified_name_lookup_error): Issue diagnostic for private 'ivar' access. - + 2010-10-17 Iain Sandoe - * parser.c (cp_parser_objc_visibility_spec): Update to use visibility + * parser.c (cp_parser_objc_visibility_spec): Update to use visibility enum, and handle @package. 2010-10-15 Jason Merrill @@ -67,12 +73,12 @@ 2010-10-14 Iain Sandoe - merge from FSF apple 'trunk' branch. + merge from FSF apple 'trunk' branch. 2006 Fariborz Jahanian - + Radars 4436866, 4505126, 4506903, 4517826 * typeck.c (finish_class_member_access_expr): Handle CLASS.property - syntax. + syntax. (cp_build_modify_expr): Likewise. * parser.c (cp_parser_objc_method_prototype_list): Handle @property. (cp_parser_objc_method_definition_list): Likewise. @@ -160,7 +166,7 @@ (value_dependent_expression_p): Added case for AT_ENCODE_EXPR. (type_dependent_expression_p): Added case for AT_ENCODE_EXPR. * parser.c (cp_parser_objc_encode_expression): Updated comment. - + 2010-10-07 Nicola Pero Merge from apple/trunk branch on FSF servers. @@ -181,19 +187,19 @@ Merge from apple/trunk branch on FSF servers. * cp-tree.def: Added AT_ENCODE_EXPR here instead of to the no longer existing gcc/c-common.def. - + 2005-12-14 Fariborz Jahanian Radar 4278774 * pt.c (tsubst_copy_and_build): Instantiate @endcode(T). - * parser.c (cp_parser_objc_encode_expression): Build a templatized + * parser.c (cp_parser_objc_encode_expression): Build a templatized parse tree for @encode(T). 2005-12-14 Fariborz Jahanian Radar 4278774 * c-common.def: Add new expression code AT_ENCODE_EXPR. - + 2010-10-06 Eric Botcazou PR c++/45908 @@ -229,9 +235,9 @@ (cp_parser_objc_method_definition_list): Same change. 2010-10-05 Nicola Pero - + Merge from apple/trunk branch on FSF servers: - + 2005-10-17 Fariborz Jahanian Radar 4290840 @@ -257,14 +263,14 @@ Radar 4093475 * parser.c (cp_parser_objc_interstitial_code): Catch stray '{' and '}' tokens and issue appropriate errors. - + 2005-08-02 Ziemowit Laski Radar 4185810 (cp_parser_statement_seq_opt): In addition to '}' and end-of-file, a statement sequence may also be terminated by a stray '@end'. - + 2010-10-05 Joseph Myers * cp-tree.h (cxx_print_error_function, @@ -298,7 +304,7 @@ Radar 4386773 * cp/parser.c (cp_parser_objc_interstitial_code): For @optional/@required set the optional/required flag. - + 2010-09-30 Nicola Pero * parser.c (cp_lexer_get_preprocessor_token): Tidied up comments @@ -341,11 +347,11 @@ (cp_build_addr_expr_1): Likewise. 2010-09-28 Iain Sandoe - + Partially merged from apple/trunk branch on FSF servers: 2006-04-26 Fariborz Jahanian Radar 3803157 (method attributes) - + * parser.c (cp_parser_objc_method_keyword_params): Handle attributes. (cp_parser_objc_method_tail_params_opt): Likewise. (cp_parser_objc_method_signature): Likewise. @@ -392,7 +398,7 @@ 2010-09-27 Nicola Pero Merge from apple/trunk branch on FSF servers: - + 2005-12-15 Fariborz Jahanian Radar 4229905 @@ -404,7 +410,7 @@ Radar 4175534 * call.c (standard_conversion): Do not issue warnings when comparing ObjC pointer types. - + 2005-06-22 Ziemowit Laski Radar 4154928 @@ -412,11 +418,12 @@ between any two ObjC pointer types. * typeck.c (composite_pointer_type): Determine common type for two ObjC pointer types. - + 2010-09-24 Jan Hubicka * decl.c (finish_function): Use decl_replaceable_p - * method.c (make_alias_for_thunk): Update call of cgraph_same_body_alias. + * method.c (make_alias_for_thunk): Update call of + cgraph_same_body_alias. 2010-09-24 Jason Merrill diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index a365603f527..85a5ea51132 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -490,7 +490,7 @@ add_to_template_args (tree args, tree extra_args) int i; int j; - if (args == NULL_TREE) + if (args == NULL_TREE || extra_args == error_mark_node) return extra_args; extra_depth = TMPL_ARGS_DEPTH (extra_args); @@ -5970,6 +5970,9 @@ coerce_template_parms (tree parms, parameters. */ int variadic_p = 0; + if (args == error_mark_node) + return error_mark_node; + nparms = TREE_VEC_LENGTH (parms); /* Determine if there are any parameter packs. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 949a391ba72..a7241cc1ab5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-10-19 Paolo Carlini + + PR c++/46046 + * g++.dg/template/crash104.C: New. + 2010-10-19 Richard Henderson * gcc.target/i386/fma3-fma.c: New. @@ -10,7 +15,7 @@ * gcc.dg/ipa/ipa-pta-10.c: Adjust. 2010-10-18 Nicola Pero - + Merge from 'apple/trunk' branch on FSF servers. 2006-03-16 Fariborz Jahanian @@ -28,31 +33,31 @@ * obj-c++.dg/property/dynamic-1.mm: New. * obj-c++.dg/property/synthesize-1.mm: New. -2010-10-18 Nicola Pero +2010-10-18 Nicola Pero * objc.dg/at-class-1.m: New. - * objc.dg/at-class-1.mm: New. - + * objc.dg/at-class-1.mm: New. + 2010-10-18 Steve Ellcey * gcc.c-torture/compile/920625-1.c: Remove dg-prune-output lines. 2010-10-18 Nicola Pero - + Merge from 'apple/trunk' branch on FSF servers. 2006-01-17 Fariborz Jahanian Radar 4407151 * obj-c++.dg/template-7.mm: New. - + 2010-10-18 Nicola Pero * objc.dg/proto-qual-1.m: Adjust test for GNU runtime to match bugfix. 2010-10-18 Nicola Pero - + Merge from 'apple/trunk' branch on FSF servers. 2005-03-01 Fariborz Jahanian @@ -75,7 +80,7 @@ * objc.dg/try-catch-11.m: New * objc.dg/try-catch-12.m: New * objc.dg/try-catch-13.m: New - + 2010-10-18 Richard Henderson * gcc.target/ia64/20101014.c: Fix double-paste of test case. @@ -115,16 +120,16 @@ * gcc.c-torture/execute/pr46019.c: New test. 2010-10-17 Nicola Pero - + Merge from 'apple/trunk' branch on FSF servers. - + 2006-04-19 Fariborz Jahanian Radar 4516785 * obj-c++.dg/method-namespace-2.mm: New. - + 2010-10-17 Nicola Pero - + Merge from 'apple/trunk' branch on FSF servers. 2006-03-27 Fariborz Jahanian @@ -132,7 +137,7 @@ Radar 4133425 * objc.dg/private-1.m: Test modified. * obj-c++.dg/private-1.mm: Test modified. - + 2010-10-17 Uros Bizjak PR testsuite/45987 diff --git a/gcc/testsuite/g++.dg/template/crash104.C b/gcc/testsuite/g++.dg/template/crash104.C new file mode 100644 index 00000000000..097c46982cb --- /dev/null +++ b/gcc/testsuite/g++.dg/template/crash104.C @@ -0,0 +1,26 @@ +// PR c++/46046 + +template + struct foo +{ + template + struct type + {}; + + template + struct type< + typename T::template some_type, + V + > + {}; +}; + +template + class bar +{}; + +int main() +{ + typedef foo > cont; + cont::type obj; // { dg-error "cannot be defined" } +}