This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PR c++/20103] failure to gimplify constructors for addressabletypes


Alexandre Oliva wrote:
This doesn't look quite right.  First, we're trying to get rid of
tsubst_copy; we should not add new calls.  You should do the RECURs
here, and then build up the new node.


I'd have to use build3 (TARGET_EXPR...) or introduce a new call to
create a target_expr with given slot, initial and cleanup, because
AFAICT there isn't any that takes a cleanup.

Yes, you should use build3.


They don't, and they can't without this piece of code. When we tsubst
INITIAL, an incomplete array type (T[]), that had been used as the
type of the slot and the target_expr itself in
finish_compound_literal(), called while processing a template,
digest_init() (or something else; I no longer remember exactly)
completes the array type with the number of entries in the INITIAL
CONSTRUCTOR.

Then you should tsubst the INITIAL first, and unconditionally copy the type to the TARGET_EXPR when you use build3. Or, even better, call the same functions in semantics.c that the parser would call if not in a template. In other words, call finish_compound_literal again, from pt.c. That's the overall design: we try to reuse the same semantic routines again at template instantiation time.


--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]