public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "Tankut Baris Aktemur (Code Review)" <gerrit@gnutoolchain-gerrit.osci.io>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@polymtl.ca>,
	Tom Tromey <tromey@sourceware.org>,
	Keith Seitz <keiths@redhat.com>
Subject: [review] gdb: fix overload resolution for see-through references
Date: Fri, 29 Nov 2019 18:57:00 -0000	[thread overview]
Message-ID: <20191129185738.A9D9F20AF6@gnutoolchain-gerrit.osci.io> (raw)
In-Reply-To: <gerrit.1573572186000.I39ae6505ab85ad0bd21915368c82540ceeb3aae9@gnutoolchain-gerrit.osci.io>

Tankut Baris Aktemur has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/617
......................................................................


Patch Set 1:

> One question about the 'an_overloaded_function (const foo &&)' overload.  It would never be legal for the compiler to call this overload when doing:
> 
>  struct foo f;
>  an_overloaded_function (f);
> 
> So why does GDB even consider it when searching for a possible overload to call?  Let's say there exists the overload 'an_overloaded_function (const foo &&)' but the overload 'an_overloaded_function (const foo &)' does not exist, and the user calls 'an_overloaded_function (f)'.  Should GDB call the && overload, or should GDB say that no compatible overload was found?

I believe it's expected that GDB will search the function during overload resolution.  For an illegal case like this, I'd expect that it ranks the function with a very high badness value, so that an infcall is refused, just like the compiler rejects it.

Currently, if you give 'f' a const type, GDB makes the call (but it's still illegal).  If non-const like above, GDB says "Attempt to take address of value not located in memory."  It seems this is a separate bug; GDB resolved the function and attempted to call it but a failure occurred during call preparation.


-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I39ae6505ab85ad0bd21915368c82540ceeb3aae9
Gerrit-Change-Number: 617
Gerrit-PatchSet: 1
Gerrit-Owner: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-Reviewer: Keith Seitz <keiths@redhat.com>
Gerrit-Reviewer: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-CC: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-Comment-Date: Fri, 29 Nov 2019 18:57:38 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

  parent reply	other threads:[~2019-11-29 18:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-12 15:23 Tankut Baris Aktemur (Code Review)
2019-11-27  7:46 ` Tankut Baris Aktemur (Code Review)
2019-11-29 16:43 ` Simon Marchi (Code Review)
2019-11-29 18:57 ` Tankut Baris Aktemur (Code Review) [this message]
2019-12-05 20:13 ` Tom Tromey (Code Review)
2019-12-06  7:25 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-12-06  7:25 ` Sourceware to Gerrit sync (Code Review)

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=20191129185738.A9D9F20AF6@gnutoolchain-gerrit.osci.io \
    --to=gerrit@gnutoolchain-gerrit.osci.io \
    --cc=gdb-patches@sourceware.org \
    --cc=gnutoolchain-gerrit@osci.io \
    --cc=keiths@redhat.com \
    --cc=simon.marchi@polymtl.ca \
    --cc=tromey@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).