public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++ Patch] PR 59120
@ 2014-04-17 16:43 Paolo Carlini
  2014-04-21 12:23 ` Jason Merrill
  0 siblings, 1 reply; 2+ messages in thread
From: Paolo Carlini @ 2014-04-17 16:43 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jason Merrill

[-- Attachment #1: Type: text/plain, Size: 353 bytes --]

Hi,

we can fix this crash during error recovery very easily, by grouping 
together the two conditions leading to skip & early return, in complete 
analogy with the single-declaration case (note that we explicitly commit 
to tentative parse at the beginning of the function, thus we are good). 
Tested x86_64-linux.

Thanks,
Paolo.

///////////////////

[-- Attachment #2: CL_59120 --]
[-- Type: text/plain, Size: 277 bytes --]

/cp
2014-04-17  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/59120
	* parser.c (cp_parser_alias_declaration): Check return value of
	cp_parser_require.

/testsuite
2014-04-17  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/59120
	* g++.dg/cpp0x/alias-decl-42.C: New.

[-- Attachment #3: patch_59120 --]
[-- Type: text/plain, Size: 1375 bytes --]

Index: cp/parser.c
===================================================================
--- cp/parser.c	(revision 209472)
+++ cp/parser.c	(working copy)
@@ -16142,20 +16142,13 @@ cp_parser_alias_declaration (cp_parser* parser)
   if (parser->num_template_parameter_lists)
     parser->type_definition_forbidden_message = saved_message;
 
-  if (type == error_mark_node)
+  if (type == error_mark_node
+      || !cp_parser_require (parser, CPP_SEMICOLON, RT_SEMICOLON))
     {
       cp_parser_skip_to_end_of_block_or_statement (parser);
       return error_mark_node;
     }
 
-  cp_parser_require (parser, CPP_SEMICOLON, RT_SEMICOLON);
-
-  if (cp_parser_error_occurred (parser))
-    {
-      cp_parser_skip_to_end_of_block_or_statement (parser);
-      return error_mark_node;
-    }
-
   /* A typedef-name can also be introduced by an alias-declaration. The
      identifier following the using keyword becomes a typedef-name. It has
      the same semantics as if it were introduced by the typedef
Index: testsuite/g++.dg/cpp0x/alias-decl-42.C
===================================================================
--- testsuite/g++.dg/cpp0x/alias-decl-42.C	(revision 0)
+++ testsuite/g++.dg/cpp0x/alias-decl-42.C	(working copy)
@@ -0,0 +1,4 @@
+// PR c++/59120
+// { dg-do compile { target c++11 } }
+
+template<typename T> using X = int T::T*;  // { dg-error "expected" }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [C++ Patch] PR 59120
  2014-04-17 16:43 [C++ Patch] PR 59120 Paolo Carlini
@ 2014-04-21 12:23 ` Jason Merrill
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2014-04-21 12:23 UTC (permalink / raw)
  To: Paolo Carlini, gcc-patches

OK.

Jason

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-21  4:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-17 16:43 [C++ Patch] PR 59120 Paolo Carlini
2014-04-21 12:23 ` Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).