]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR c++/39425 (gcc loops after reporting template instantiation errors)
authorH.J. Lu <hongjiu.lu@intel.com>
Wed, 18 Mar 2009 15:00:32 +0000 (15:00 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Wed, 18 Mar 2009 15:00:32 +0000 (08:00 -0700)
gcc/cp/

2009-03-18  H.J. Lu  <hongjiu.lu@intel.com>

Backport from mainline:
2009-03-18  H.J. Lu  <hongjiu.lu@intel.com>

PR c++/39425
* parser.c (cp_parser_explicit_specialization): Don't skip the
rest of the specialization when begin_specialization returns
false.

gcc/testsuite/

2009-03-18  H.J. Lu  <hongjiu.lu@intel.com>

Backport from mainline:
2009-03-18  H.J. Lu  <hongjiu.lu@intel.com>

PR c++/39425
* g++.dg/template/pr39425.C: New.

* g++.dg/template/spec33.C: Updated.

From-SVN: r144933

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/pr39425.C [new file with mode: 0644]
gcc/testsuite/g++.dg/template/spec33.C

index 082de660ce03f50f27f10e1fb0a5972ffcbb075d..3c8006ed6c8b2e0163725f12f277291fe2d69657 100644 (file)
@@ -1,3 +1,13 @@
+2009-03-18  H.J. Lu  <hongjiu.lu@intel.com>
+
+       Backport from mainline:
+       2009-03-18  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR c++/39425
+       * parser.c (cp_parser_explicit_specialization): Don't skip the
+       rest of the specialization when begin_specialization returns
+       false.
+
 2009-03-04  Jason Merrill  <jason@redhat.com>
 
        PR c++/9634
index 5134d7dd890ea2593e86e3b8ae2b3d422ea50ca4..8247c9cc0d8f7d1291ce2a5f38ee8b97c4020b43 100644 (file)
@@ -10497,7 +10497,6 @@ cp_parser_explicit_specialization (cp_parser* parser)
   if (!begin_specialization ())
     {
       end_specialization ();
-      cp_parser_skip_to_end_of_block_or_statement (parser);
       return;
     }
 
index 8f3ee1cc729a10f9f61d588c7650edec08c34f46..5c9b6fa93c633febf0d317bbc99352c7add9b006 100644 (file)
@@ -1,3 +1,13 @@
+2009-03-18  H.J. Lu  <hongjiu.lu@intel.com>
+
+       Backport from mainline:
+       2009-03-18  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR c++/39425
+       * g++.dg/template/pr39425.C: New.
+
+       * g++.dg/template/spec33.C: Updated.
+
 2009-03-13  H.J. Lu  <hongjiu.lu@intel.com>
 
        Backport from mainline:
diff --git a/gcc/testsuite/g++.dg/template/pr39425.C b/gcc/testsuite/g++.dg/template/pr39425.C
new file mode 100644 (file)
index 0000000..a063e05
--- /dev/null
@@ -0,0 +1,18 @@
+// PR c++/39425
+// { dg-do compile }
+
+class a {
+
+  template<unsigned int s>
+    struct _rec {
+      static const char size = _rec< (s >> 1) >::size;
+    };
+
+  template<>   // { dg-error "explicit" }
+  struct _rec <0> {
+    static const char size = 0;
+  };
+
+  static const unsigned int value = _rec < 1 >::size;
+
+}              // { dg-error "unqualified-id" }
index 809d4f012c1ad886c9f4449c675cecadbd99ca55..7b7a7519829aeb988f50d2073181de86eaeb3a78 100644 (file)
@@ -3,5 +3,5 @@
 struct A
 {
     template<int> static void foo   () {}
-    template<>    static void foo<0>() {}  // { dg-error "explicit" }
+    template<>    static void foo<0>() {}  // { dg-error "explicit|template" }
 };