From d2cc46cbe949d341e905fd347adca5751d938aa0 Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 1 Mar 2002 13:50:28 +0000 Subject: [PATCH] 2002-03-01 Michael Matz * typeck.c (cp_pointer_int_sum): Complete inner type which is used later by size_in_bytes(). git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@50197 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/typeck.c | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 46d6b3fdd93..f1c25a4d4ff 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2002-03-01 Michael Matz + + * typeck.c (cp_pointer_int_sum): Complete inner type which is + used later by size_in_bytes(). + 2002-03-01 Phil Edwards * cp-tree.h: Require __GNUC__ to be #defined. diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 6ca524233d8..e5f643c72d8 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -4076,8 +4076,14 @@ cp_pointer_int_sum (resultcode, ptrop, intop) enum tree_code resultcode; register tree ptrop, intop; { - if (!complete_type_or_else (TREE_TYPE (ptrop), ptrop)) - return error_mark_node; + tree res_type = TREE_TYPE (ptrop); + + /* pointer_int_sum() uses size_in_bytes() on the TREE_TYPE(res_type) + in certain circumstance (when it's valid to do so). So we need + to make sure it's complete. We don't need to check here, if we + can actually complete it at all, as those checks will be done in + pointer_int_sum() anyway. */ + complete_type (TREE_TYPE (res_type)); return pointer_int_sum (resultcode, ptrop, fold (intop)); } -- 2.11.0