This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ Patch] PR 37260
- From: Paolo Carlini <paolo dot carlini at oracle dot com>
- To: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Cc: Mark Mitchell <mark at codesourcery dot com>
- Date: Thu, 28 Aug 2008 19:31:35 +0200
- Subject: [C++ Patch] PR 37260
Hi,
adding a check for error_mark_node, as suggested by Mike Stump, avoids
looping forever on the error. Tested x86_64-linux.
Ok for mainline?
Paolo.
///////////////////
/cp
2008-08-28 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/37260
* decl.c (reshape_init_r): Check init for error_mark_node.
/testsuite
2008-08-28 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/37260
* g++.dg/parse/crash44.C: New.
Index: testsuite/g++.dg/parse/crash44.C
===================================================================
*** testsuite/g++.dg/parse/crash44.C (revision 0)
--- testsuite/g++.dg/parse/crash44.C (revision 0)
***************
*** 0 ****
--- 1,15 ----
+ // PR c++/37260
+ // { dg-options "" }
+
+ struct pthread_once_t { };
+ struct test {
+ pthread_once_t once;
+ };
+
+ int main(void) {
+ struct test foo = {
+ once: PTHREAD_ONCE_INITIALIZER // { dg-error "error: 'PTHREAD_ONCE_INITIALIZER' was not declared in this scope" }
+ };
+
+ return 0;
+ }
Index: cp/decl.c
===================================================================
*** cp/decl.c (revision 139702)
--- cp/decl.c (working copy)
*************** reshape_init_r (tree type, reshape_iter
*** 4772,4777 ****
--- 4772,4780 ----
{
tree init = d->cur->value;
+ if (error_operand_p (init))
+ return error_mark_node;
+
/* A non-aggregate type is always initialized with a single
initializer. */
if (!CP_AGGREGATE_TYPE_P (type))