Still working on this problem. A full example would lool like the attachment. A being the base class and B being the constant class. Another option would be to do the calls manually. e.g. A a1 = A (INT) a1->i = 123 But it still presents the same issue. I need to find the correct constructor which takes the type argument so its not really an improvement. Anyone got any ideas how this could be achieved? Cheers, Lennart Weller On Fri, May 08, 2015 at 11:29:06AM +0200, Weller wrote: > Hey everyone, > > I'm currently stomped on how to call_function_by_hand for a constructor. > Basically I have a class in C++ which wraps multiple native data types to > the underlying base class like this: > > class constant_t: public value_t > { constant_t (int); > constant_t (double); > constant_t (const char *); > } > > Now when I have a command line like > (gdb) p $testnr1 + 0.1 > I need the function call to the constructor of constant_t so that I can > use the operator+ on the value_t of $testnr1. > > I looked through the code and the only thing I could find which came > close to this was the code used for the operator overload on C++ classes > with find_overload_match but I can't quite figure out how I would call > this in case of an overloaded constructor. Do I need to create an object > of type constant_t with it being passed to **args and **objp? In that > case how would I achieve that, as the the created object is kinda what I > want in the first place. > > Any help is appreciated, > Lennart