aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2014-03-13 16:05:15 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2014-03-13 16:05:15 +0000
commitb0a87402783d157875be6667d3d5bcf3396463a6 (patch)
tree889bbda4c0fc95e7a6fd3041ebf337211ada40aa
parent7891065aa73da81e05d93711637c737fccd34678 (diff)
downloadgcc-b0a87402783d157875be6667d3d5bcf3396463a6.zip
gcc-b0a87402783d157875be6667d3d5bcf3396463a6.tar.gz
gcc-b0a87402783d157875be6667d3d5bcf3396463a6.tar.bz2
re PR c++/60383 (ICE with invalid template specialization)
/cp 2014-03-13 Paolo Carlini <paolo.carlini@oracle.com> PR c++/60383 * pt.c (maybe_process_partial_specialization): Check return value of check_specialization_namespace. /testsuite 2014-03-13 Paolo Carlini <paolo.carlini@oracle.com> PR c++/60383 * g++.dg/template/crash118.C: New. * g++.dg/template/crash95.C: Adjust. From-SVN: r208550
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c4
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/g++.dg/template/crash118.C11
-rw-r--r--gcc/testsuite/g++.dg/template/crash95.C2
5 files changed, 27 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index e5732f2..d90b988 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,11 @@
2014-03-13 Paolo Carlini <paolo.carlini@oracle.com>
+ PR c++/60383
+ * pt.c (maybe_process_partial_specialization): Check return value
+ of check_specialization_namespace.
+
+2014-03-13 Paolo Carlini <paolo.carlini@oracle.com>
+
PR c++/60254
* semantics.c (finish_static_assert): Call cxx_constant_value only
if require_potential_rvalue_constant_expression returns true.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 7e287f7..c791d03 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 fd7e979..ba1b7e8 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2014-03-13 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/60383
+ * g++.dg/template/crash118.C: New.
+ * g++.dg/template/crash95.C: Adjust.
+
2014-03-13 Vladimir Makarov <vmakarov@redhat.com>
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 0000000..e0de605
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/crash118.C
@@ -0,0 +1,11 @@
+// PR c++/60383
+
+template<int> struct A
+{
+ template<typename> struct B
+ {
+ template<typename T> struct B<T*> {}; // { dg-error "specialization" }
+ };
+};
+
+A<0>::B<char*> b;
diff --git a/gcc/testsuite/g++.dg/template/crash95.C b/gcc/testsuite/g++.dg/template/crash95.C
index 2ad9e98..f60e635 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" }