From: Paolo Carlini Date: Thu, 13 Mar 2014 16:05:15 +0000 (+0000) Subject: re PR c++/60383 (ICE with invalid template specialization) X-Git-Tag: releases/gcc-4.9.0~465 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b0a87402783d157875be6667d3d5bcf3396463a6;p=thirdparty%2Fgcc.git re PR c++/60383 (ICE with invalid template specialization) /cp 2014-03-13 Paolo Carlini PR c++/60383 * pt.c (maybe_process_partial_specialization): Check return value of check_specialization_namespace. /testsuite 2014-03-13 Paolo Carlini PR c++/60383 * g++.dg/template/crash118.C: New. * g++.dg/template/crash95.C: Adjust. From-SVN: r208550 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e5732f2d490e..d90b9881c313 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2014-03-13 Paolo Carlini + + PR c++/60383 + * pt.c (maybe_process_partial_specialization): Check return value + of check_specialization_namespace. + 2014-03-13 Paolo Carlini PR c++/60254 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 7e287f793e85..c791d031ae19 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -850,7 +850,9 @@ maybe_process_partial_specialization (tree type) if (CLASSTYPE_IMPLICIT_INSTANTIATION (type) && !COMPLETE_TYPE_P (type)) { - check_specialization_namespace (CLASSTYPE_TI_TEMPLATE (type)); + if (!check_specialization_namespace (CLASSTYPE_TI_TEMPLATE (type)) + && !at_namespace_scope_p ()) + return error_mark_node; SET_CLASSTYPE_TEMPLATE_SPECIALIZATION (type); DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (type)) = input_location; if (processing_template_decl) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fd7e9795a289..ba1b7e8c992d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2014-03-13 Paolo Carlini + + PR c++/60383 + * g++.dg/template/crash118.C: New. + * g++.dg/template/crash95.C: Adjust. + 2014-03-13 Vladimir Makarov PR rtl-optimization/57189 diff --git a/gcc/testsuite/g++.dg/template/crash118.C b/gcc/testsuite/g++.dg/template/crash118.C new file mode 100644 index 000000000000..e0de605f707f --- /dev/null +++ b/gcc/testsuite/g++.dg/template/crash118.C @@ -0,0 +1,11 @@ +// PR c++/60383 + +template struct A +{ + template struct B + { + template struct B {}; // { dg-error "specialization" } + }; +}; + +A<0>::B b; diff --git a/gcc/testsuite/g++.dg/template/crash95.C b/gcc/testsuite/g++.dg/template/crash95.C index 2ad9e9816666..f60e635ae66d 100644 --- a/gcc/testsuite/g++.dg/template/crash95.C +++ b/gcc/testsuite/g++.dg/template/crash95.C @@ -8,4 +8,4 @@ template < typename > struct S }; }; -S < int > s(0); // { dg-error "incomplete type" } +S < int > s(0); // { dg-error "no matching" }