]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/60383 (ICE with invalid template specialization)
authorPaolo Carlini <paolo.carlini@oracle.com>
Thu, 13 Mar 2014 16:05:15 +0000 (16:05 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Thu, 13 Mar 2014 16:05:15 +0000 (16:05 +0000)
/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

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/crash118.C [new file with mode: 0644]
gcc/testsuite/g++.dg/template/crash95.C

index e5732f2d490ea0af007c34af920a5a5c3f4a9434..d90b9881c313959392b28412f9f8e41dc5c32ba6 100644 (file)
@@ -1,3 +1,9 @@
+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
index 7e287f793e858ab816d9c02ad7ff44364d98e8ae..c791d031ae19d1168cfd86e0601d1757c20e693d 100644 (file)
@@ -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)
index fd7e9795a28953e2468fe17e7a5f8dff22bf042d..ba1b7e8c992d17e39f0009a58e2c995fac362f01 100644 (file)
@@ -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 (file)
index 0000000..e0de605
--- /dev/null
@@ -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;
index 2ad9e9816666fd5fc98d8fda3ca00ab48e4a5bb8..f60e635ae66dce537e27b635cba7959c38ea942b 100644 (file)
@@ -8,4 +8,4 @@ template < typename > struct S
   };
 };
 
-S < int > s(0); // { dg-error "incomplete type" }
+S < int > s(0); // { dg-error "no matching" }