diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e5732f2d490..d90b9881c31 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 7e287f793e8..c791d031ae1 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 fd7e9795a28..ba1b7e8c992 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 00000000000..e0de605f707 --- /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 2ad9e981666..f60e635ae66 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" }