public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/100335] Using statement of a ref-qualified method from base class: method not callable on derived object
Date: Fri, 30 Apr 2021 10:29:37 +0000	[thread overview]
Message-ID: <bug-100335-4-4pDNHdHzcu@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-100335-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100335

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to W E Brown from comment #4)
> In brief, I believe Comment 3's example ought compile due to
> [namespace.udecl]/14, but the original example ought not compile due to
> [over.load]/2.3.

But [over.load]/2.3 is not why GCC gives an error. The definition of Derived is
accepted, it's trying to call declval<const Derived&>().method() that is
rejected.

None of GCC, Clang, EDG or MSVC reject the definition of Derived.

(In reply to Daniel from comment #5)
> As a sidenote, the original example is also compiling if test object is made
> non-const, i.e. "const Derived test;" is replaced with "Derived test;"
> 
> If the argument in Comment 1 is true than the program would still be
> ill-formed in this case, wouldn't it?

Yes.

I'm not sure what the relevant rule is here, but I don't think it's
[over.load]/2.3

  parent reply	other threads:[~2021-04-30 10:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-29 14:48 [Bug c++/100335] New: " Daniel.Withopf at web dot de
2021-04-29 21:01 ` [Bug c++/100335] " webrown.cpp at gmail dot com
2021-04-29 21:47 ` Daniel.Withopf at web dot de
2021-04-29 21:53 ` redi at gcc dot gnu.org
2021-04-30  1:18 ` webrown.cpp at gmail dot com
2021-04-30  6:45 ` Daniel.Withopf at web dot de
2021-04-30 10:29 ` redi at gcc dot gnu.org [this message]
2021-05-03  6:38 ` Daniel.Withopf at web dot de
2021-05-03 14:15 ` redi at gcc dot gnu.org

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=bug-100335-4-4pDNHdHzcu@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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).