]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/18757 (ICE (on invalid) in get_innermost_template_args)
authorAlexandre Oliva <aoliva@redhat.com>
Tue, 1 Feb 2005 07:04:00 +0000 (07:04 +0000)
committerAlexandre Oliva <aoliva@gcc.gnu.org>
Tue, 1 Feb 2005 07:04:00 +0000 (07:04 +0000)
gcc/cp/ChangeLog:
PR c++/18757
PR c++/19366
PR c++/19499
* parser.c (cp_parser_template_id): Revert 2004-12-09's patch.
Issue an error when creating the template id.
* pt.c (fn_type_unification): Return early if the explicit
template arg list is an error_mark_node.
gcc/testsuite/ChangeLog:
* g++.dg/parse/typename7.C: Adjust error messages.

From-SVN: r94528

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/typename7.C

index 869878c9d154090ed8ea2886e7e98cbd63fe9527..01dc50a5fb263e4b601a0c9a85cdb89d893564bd 100644 (file)
@@ -1,3 +1,13 @@
+2005-02-01  Alexandre Oliva  <aoliva@redhat.com>
+
+       PR c++/18757
+       PR c++/19366
+       PR c++/19499
+       * parser.c (cp_parser_template_id): Revert 2004-12-09's patch.
+       Issue an error when creating the template id.
+       * pt.c (fn_type_unification): Return early if the explicit
+       template arg list is an error_mark_node.
+
 2005-01-27  J"orn Rennecke <joern.rennecke@st.com>
 
        PR c++/18370
index 46d6bbf157f4ef2f8a5c0b769a6ef9f361b7a69a..867896b444ab3cc8a49be032ddcefd2f88127f72 100644 (file)
@@ -8015,7 +8015,7 @@ cp_parser_template_id (cp_parser *parser,
      the effort required to do the parse, nor will we issue duplicate
      error messages about problems during instantiation of the
      template.  */
-  if (start_of_id >= 0 && !cp_parser_error_occurred (parser))
+  if (start_of_id >= 0)
     {
       cp_token *token;
 
@@ -8031,6 +8031,13 @@ cp_parser_template_id (cp_parser *parser,
       token->keyword = RID_MAX;
       /* Purge all subsequent tokens.  */
       cp_lexer_purge_tokens_after (parser->lexer, token);
+
+      /* ??? Can we actually assume that, if template_id ==
+        error_mark_node, we will have issued a diagnostic to the
+        user, as opposed to simply marking the tentative parse as
+        failed?  */
+      if (cp_parser_error_occurred (parser) && template_id != error_mark_node)
+       error ("parse error in template argument list");
     }
 
   pop_deferring_access_checks ();
index 8472bbb698f3024af6299593cbd26a68c5d348f6..5409fd31436b16091a7d35d98d71728e685ebc13 100644 (file)
@@ -8935,6 +8935,9 @@ fn_type_unification (tree fn,
       tree converted_args;
       bool incomplete;
 
+      if (explicit_targs == error_mark_node)
+       return 1;
+
       converted_args
        = (coerce_template_parms (DECL_INNERMOST_TEMPLATE_PARMS (fn), 
                                  explicit_targs, NULL_TREE, tf_none, 
index a923a6a7fbbfa9e986af7d753d6c454cc6cfb04f..ee8ddc8bea8a9433fad91d2555dad6de9bb3d76a 100644 (file)
@@ -1,3 +1,7 @@
+2005-02-01  Alexandre Oliva  <aoliva@redhat.com>
+
+       * g++.dg/parse/typename7.C: Adjust error messages.
+
 2005-01-26  Ulrich Weigand  <uweigand@de.ibm.com>
 
        Backport from mainline:
index 211931781394c037c071e58ad304e3edf99054b0..56fcc7436a4a20a4cacc093a55c83f4789b7adbf 100644 (file)
@@ -9,23 +9,23 @@ struct A
 {
   template<typename>   void foo(int);
   template<typename T> void bar(T t) {
-    this->foo<typename T>(t); } // { dg-error "expected" }
+    this->foo<typename T>(t); } // { dg-error "expected|parse error|no matching" }
   template<typename T> void bad(T t) {
-    foo<typename T>(t); } // { dg-error "expected" }
+    foo<typename T>(t); } // { dg-error "expected|parse error" }
 };
 
 template <typename T>
 struct B
 {
   void bar(T t) {
-    A().bar<typename T>(t); } // { dg-error "expected" }
+    A().bar<typename T>(t); } // { dg-error "expected|parse error|no matching" }
   void bad(T t) {
     B<typename T>::bar(t); } // { dg-error "invalid|not a template" }
 };
 
 void baz()
 {
-    A().bar(0);
-    A().bad(0);
-    B<int>().bar(0);
+  A().bar(0);
+  A().bad(0);
+  B<int>().bar(0);
 }