From 644809883ad9a6cbd573001b3a5f5fdc3dfbe237 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Sun, 4 Apr 2004 22:51:02 +0000 Subject: [PATCH] re PR c++/14804 ([unit-at-a-time] initializing const data with reinterpret_cast-ed pointer-to-member function crashes) PR c++/14804 * varasm.c (initializer_constant_valid_p): Allow NOP_EXPRs to RECORD_TYPEs. From-SVN: r80404 --- gcc/ChangeLog | 6 ++++++ gcc/varasm.c | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4bdea47f5d9..582add276f3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2004-04-04 Mark Mitchell + + PR c++/14804 + * varasm.c (initializer_constant_valid_p): Allow NOP_EXPRs to + RECORD_TYPEs. + 2004-04-04 Mark Mitchell * doc/invoke.texi (-mabi=o64): Create link to O64 ABI diff --git a/gcc/varasm.c b/gcc/varasm.c index a518dd765ae..707ad4bbe65 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -3332,8 +3332,10 @@ initializer_constant_valid_p (tree value, tree endtype) endtype); } - /* Allow conversions to union types if the value inside is okay. */ - if (TREE_CODE (TREE_TYPE (value)) == UNION_TYPE) + /* Allow conversions to struct or union types if the value + inside is okay. */ + if (TREE_CODE (TREE_TYPE (value)) == RECORD_TYPE + || TREE_CODE (TREE_TYPE (value)) == UNION_TYPE) return initializer_constant_valid_p (TREE_OPERAND (value, 0), endtype); break; -- 2.30.2