Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Keith Seitz <keiths@redhat.com>
To: Tom de Vries <tdevries@suse.de>, gdb-patches@sourceware.org
Subject: Re: [PATCH 1/2] [gdb/testsuite] Fix ambiguous operator warning
Date: Fri, 29 May 2026 09:23:22 -0700	[thread overview]
Message-ID: <6d0c9018-606f-40a9-ad14-1476ef6534ee@redhat.com> (raw)
In-Reply-To: <20260529125149.2027857-2-tdevries@suse.de>

On 5/29/26 5:51 AM, Tom de Vries wrote:
> With gcc 16, defaulting to c++20, and test-case gdb.cp/cmpd-minsyms.exp I run
> into:
> ...
> cmpd-minsyms.cc: In function 'int main(int, char**)':^M
> cmpd-minsyms.cc:39:13: warning: C++20 says that these are ambiguous, even \
>    though the second is reversed:^M
>     39 |    if (a == b)^M
>        |             ^^M
> cmpd-minsyms.cc:26:8: note: candidate 1: 'int GDB<T>::operator==(const GDB<T>&) [with T = int]'^M
>     26 |    int operator == (GDB const& other)^M
>        |        ^~~~~~~~^M
> cmpd-minsyms.cc:26:8: note: candidate 2: 'int GDB<T>::operator==(const GDB<T>&) [with T = int]' (reversed)^M
> cmpd-minsyms.cc:26:8: note: try making the operator a 'const' member function^M
> ...
> 
> Fix this by following the advice:
> ...
> -   int operator == (GDB const& other)
> +   int operator == (GDB const& other) const
>      { return 1; }
> ...
> 
> Likewise in gdb.cp/many-args.exp.

This LGTM.

Reviewed-By: Keith Seitz <keiths@redhat.com>

Keith


  reply	other threads:[~2026-05-29 16:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-29 12:51 [PATCH 0/2] [gdb/testsuite] Handle gcc 16 Tom de Vries
2026-05-29 12:51 ` [PATCH 1/2] [gdb/testsuite] Fix ambiguous operator warning Tom de Vries
2026-05-29 16:23   ` Keith Seitz [this message]
2026-05-29 12:51 ` [PATCH 2/2] [gdb/testsuite] Use Wno-non-c-typedef-for-linkage for gcc 16 Tom de Vries
2026-05-29 16:25   ` Keith Seitz
2026-05-30  8:49     ` Tom de Vries

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=6d0c9018-606f-40a9-ad14-1476ef6534ee@redhat.com \
    --to=keiths@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    /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