aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2003-12-17 04:45:53 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2003-12-17 04:45:53 +0000
commit0dff37fb924f4d2c44f2912a524dfc4c152ce945 (patch)
treef5615486a4ca2c135e1b0e06d6be4f8306350666 /gcc/cp/decl.c
parent085bd3ffb60640b70a646f430e973437f3ceaed2 (diff)
downloadgcc-0dff37fb924f4d2c44f2912a524dfc4c152ce945.zip
gcc-0dff37fb924f4d2c44f2912a524dfc4c152ce945.tar.gz
gcc-0dff37fb924f4d2c44f2912a524dfc4c152ce945.tar.bz2
re PR c++/12218 (runtime segfault when initializing global variable with pointer-to-member)
PR c++/12218 * varasm.c (initializer_constant_valid_p): Allow a conversion from an integral constant to an OFFSET_TYPE. PR c++/12696 * decl.c (reshape_init): Recover quickly from errors. PR c++/12218 * g++.dg/init/pm3.C: New test. PR c++/12696 * g++.dg/init/error1.C: New test. From-SVN: r74731
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index c054bfb..5677781 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -4271,8 +4271,11 @@ reshape_init (tree type, tree *initp)
empty class shall have the form of an empty
initializer-list {}. */
if (!brace_enclosed_p)
- error ("initializer for `%T' must be brace-enclosed",
- type);
+ {
+ error ("initializer for `%T' must be brace-enclosed",
+ type);
+ return error_mark_node;
+ }
}
else
{
@@ -4297,6 +4300,8 @@ reshape_init (tree type, tree *initp)
break;
field_init = reshape_init (TREE_TYPE (field), initp);
+ if (field_init == error_mark_node)
+ return error_mark_node;
TREE_CHAIN (field_init) = CONSTRUCTOR_ELTS (new_init);
CONSTRUCTOR_ELTS (new_init) = field_init;
/* [dcl.init.aggr]
@@ -4327,6 +4332,8 @@ reshape_init (tree type, tree *initp)
tree element_init;
element_init = reshape_init (TREE_TYPE (type), initp);
+ if (element_init == error_mark_node)
+ return error_mark_node;
TREE_CHAIN (element_init) = CONSTRUCTOR_ELTS (new_init);
CONSTRUCTOR_ELTS (new_init) = element_init;
if (TREE_PURPOSE (element_init))