>>>>> "Richard" == Richard Henderson writes: > Given that the front end has to know about the semantics of copying > objects and how that affects parameter passing anyway, perhaps the > front end should modify the type of the parameter at the same time. > Perhaps a REFERENCE_TYPE with DECL_ARTIFICIAL set? Then an ADDR_EXPR > would match up nicely. It occurred to me that we already have DECL_ARG_TYPE for handling this sort of thing. This patch sets DECL_ARG_TYPE to a REFERENCE_TYPE if we want to pass by invisible reference for frontend-specific reasons. These semantics are handled by three new functions in cp/call.c; the rest of the patch is telling other bits of code to use them. Tested i686-pc-linux-gnu. I'll check this in soon if nobody complains. 2002-07-25 Jason Merrill * function.c (assign_parms): Handle frontend-directed pass by invisible reference. cp/ * call.c (build_over_call): Likewise. (cp_convert_parm_for_inlining): New fn. (convert_for_arg_passing): New fn. (convert_default_arg, build_over_call): Use it. (type_passed_as): New fn. * pt.c (tsubst_decl): Use it. * decl2.c (cp_build_parm_decl): New fn. (build_artificial_parm): Use it. (start_static_storage_duration_function): Likewise. * decl.c (start_cleanup_fn, grokdeclarater): Likewise. (grokparms): Don't mess with DECL_ARG_TYPE. * typeck.c (convert_arguments): Use convert_for_arg_passing. * cp-lang.c (LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING): Define. * cp-tree.h: Declare new fns.