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

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>

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

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

From-SVN: r144932

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 1f5dd9d75f50b5581062af890e8f7a2bb34da987..ecf1bc634cec8da99204eeabda85562bf8969088 100644 (file)
@@ -1,3 +1,10 @@
+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-17  Jason Merrill  <jason@redhat.com>
 
        * decl.c (grokfndecl): Set DECL_CONTEXT on parms.
index 4c6fd4a78c5969937ddfa8f953367c76a3d7439b..7206af2e4a44ddde8568d07d46b5ccd9978ca533 100644 (file)
@@ -10883,7 +10883,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 b59350c54447946dc04eb37159b43b64915ae1e8..c9d0832fbc35a4ccbc7a2c9de7cb9cf491fa04d0 100644 (file)
@@ -1,3 +1,10 @@
+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-17  Jason Merrill  <jason@redhat.com>
 
        * g++.dg/cpp0x/auto6.C, auto12.C: Update mangling.
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" }
 };