From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keith Seitz To: Daniel Berlin Cc: Subject: Re: [RFC] eval.c (evaluate_subexp_standard) Deal with c++ referenceargs Date: Tue, 23 Oct 2001 11:48:00 -0000 Message-id: References: <507580B9-C7E6-11D5-9D5A-0030657B5340@cgsoftware.com> X-SW-Source: 2001-10/msg00303.html On Tue, 23 Oct 2001, Daniel Berlin wrote: > > > Neither args[0], nor argvec[1], will always be the this pointer. > Try a static class method. Oops. I forgot about that. I'll see if I can unwind some of this mess... Keith > > > + /* Before calling a c++ function, check that reference types are > > + passed as reference types and not something else. */ > > + if (argvec[0] != NULL && exp->language_defn->la_language == > > language_cplus) > > + { > > + struct type **args; > > + args = TYPE_ARG_TYPES (VALUE_TYPE (argvec[0])); > > + if (args != NULL) > > + { > > + /* args[0] = "this" pointer > > + args[1] = first arg type > > + argvec[0] = method > > + argvec[1] = "this" pointer > > + argvec[2] = first argument */ > > + for (ix = 1; args[ix] != NULL > > + && TYPE_CODE (args[ix]) != TYPE_CODE_VOID; ix++) > > + { > > + if (TYPE_CODE (args[ix]) == TYPE_CODE_REF > > + && TYPE_CODE (VALUE_TYPE (argvec[2+ix-1])) != TYPE_CODE_REF) > > + { > > + struct value *v = value_addr (argvec[2+ix-1]); > > + argvec[2+ix-1] = > > + value_cast (lookup_reference_type (VALUE_TYPE (v)), v); > > + } > > + } > > + } > > + } > > + > > do_call_it: > > > > if (noside == EVAL_SKIP) > > > > > >