OSDN Git Service

/cp
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 17 Apr 2012 17:45:25 +0000 (17:45 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 17 Apr 2012 17:45:25 +0000 (17:45 +0000)
2012-04-17  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/53003
* parser.c (cp_parser_member_declaration): Check that
initializer_token_start is non null before dereferencing it.

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

PR c++/53003
* g++.dg/parse/crash59.C: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@186544 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 83325c1..a05e021 100644 (file)
@@ -1,3 +1,9 @@
+2012-04-17  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/53003
+       * parser.c (cp_parser_member_declaration): Check that
+       initializer_token_start is non null before dereferencing it.
+
 2012-04-16  Jason Merrill  <jason@redhat.com>
 
        PR c++/38543
index 5bff67d..9b1478a 100644 (file)
@@ -19105,7 +19105,7 @@ cp_parser_member_declaration (cp_parser* parser)
                     possible that this fact is an oversight in the
                     standard, since a pure function may be defined
                     outside of the class-specifier.  */
-                 if (initializer)
+                 if (initializer && initializer_token_start)
                    error_at (initializer_token_start->location,
                              "pure-specifier on function-definition");
                  decl = cp_parser_save_member_function_body (parser,
index b233a8b..939da80 100644 (file)
@@ -1,3 +1,8 @@
+2012-04-17  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/53003
+       * g++.dg/parse/crash59.C: New.
+
 2012-04-16  Jason Merrill  <jason@redhat.com>
 
        PR c++/38543
diff --git a/gcc/testsuite/g++.dg/parse/crash59.C b/gcc/testsuite/g++.dg/parse/crash59.C
new file mode 100644 (file)
index 0000000..e5e6298
--- /dev/null
@@ -0,0 +1,3 @@
+// PR c++/53003
+
+struct A{ void a{} return b  // { dg-error "function definition|expected" }