]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/57352 (internal compiler error in cp_parser_abort_tentative_parse at cp...
authorPaolo Carlini <paolo.carlini@oracle.com>
Wed, 22 May 2013 22:45:55 +0000 (22:45 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Wed, 22 May 2013 22:45:55 +0000 (22:45 +0000)
/cp
2013-05-22  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/57352
* parser.c (cp_parser_conversion_type_id): Set up
parser->type_definition_forbidden_message before calling
cp_parser_type_specifier_seq.

/testsuite
2013-05-22  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/57352
* g++.dg/parse/crash62.C: New.

From-SVN: r199224

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

index 47cb6d325477a841123042529f2a4b10e111fb81..f665312bdeb9539e4aacecc2213ef856eb517c8f 100644 (file)
@@ -1,3 +1,10 @@
+2013-05-22  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/57352
+       * parser.c (cp_parser_conversion_type_id): Set up
+       parser->type_definition_forbidden_message before calling
+       cp_parser_type_specifier_seq.
+
 2013-05-22  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/57211
index c3096d372abcf5a3d22cc4a345b22a208261da6f..061b5714790e5910add0c23223ecd1aa20d1ef70 100644 (file)
@@ -11715,13 +11715,22 @@ cp_parser_conversion_type_id (cp_parser* parser)
   cp_decl_specifier_seq type_specifiers;
   cp_declarator *declarator;
   tree type_specified;
+  const char *saved_message;
 
   /* Parse the attributes.  */
   attributes = cp_parser_attributes_opt (parser);
+
+  saved_message = parser->type_definition_forbidden_message;
+  parser->type_definition_forbidden_message
+    = G_("types may not be defined in a conversion-type-id");
+
   /* Parse the type-specifiers.  */
   cp_parser_type_specifier_seq (parser, /*is_declaration=*/false,
                                /*is_trailing_return=*/false,
                                &type_specifiers);
+
+  parser->type_definition_forbidden_message = saved_message;
+
   /* If that didn't work, stop.  */
   if (type_specifiers.type == error_mark_node)
     return error_mark_node;
index 80c6b0bfa22ec6b361f70c5d2a3b346a23e9a686..80657f43c3e97a775cd507c03b5bfe3a563a71fe 100644 (file)
@@ -1,3 +1,8 @@
+2013-05-22  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/57352
+       * g++.dg/parse/crash62.C: New.
+
 2013-05-22  Michael Meissner  <meissner@linux.vnet.ibm.com>
            Pat Haugen <pthaugen@us.ibm.com>
            Peter Bergner <bergner@vnet.ibm.com>
diff --git a/gcc/testsuite/g++.dg/parse/crash62.C b/gcc/testsuite/g++.dg/parse/crash62.C
new file mode 100644 (file)
index 0000000..230d162
--- /dev/null
@@ -0,0 +1,6 @@
+// PR c++/57352
+
+struct x
+{
+  operator class {} ();  // { dg-error "types|expected" }
+};