Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Weller <weller@bfw-online.de>
To: gdb@sourceware.org
Subject: find_overload_match for constructor
Date: Fri, 08 May 2015 09:29:00 -0000	[thread overview]
Message-ID: <20150508092906.GA23005@bfw-online.de> (raw)

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


             reply	other threads:[~2015-05-08  9:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-08  9:29 Weller [this message]
2015-05-29 11:29 ` Weller
2015-05-29 11:35   ` Jan Kratochvil
2015-05-29 11:42     ` Weller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150508092906.GA23005@bfw-online.de \
    --to=weller@bfw-online.de \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox