public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/100335] New: Using statement of a ref-qualified method from base class: method not callable on derived object
@ 2021-04-29 14:48 Daniel.Withopf at web dot de
  2021-04-29 21:01 ` [Bug c++/100335] " webrown.cpp at gmail dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Daniel.Withopf at web dot de @ 2021-04-29 14:48 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100335
           Summary: Using statement of a ref-qualified method from base
                    class: method not callable on derived object
           Product: gcc
           Version: 10.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Daniel.Withopf at web dot de
  Target Milestone: ---

The following code examples defines 2 ref-qualified method with identical names
in a base class (const& and const&&). Derived also defines a (non-const) method
with the same name and adds a "using Base::method;"

With all gcc Versions I tested (10.3, 9.3, 8.3, 7.5), the compilation with
--std=c++11 or --std=c++14 fails if the method in the derived class does not
have a ref-qualifier.

class Base {
public:
  void method() const&& {}
  void method() const& {}
};

class Derived : public Base {
public:
  using Base::method;
  // this leads to a compiler error
  void method() {}

  // with a ref-qualifier the code is compiling
  //  void method() & {}
};

int main() {
    const Derived test;
    test.method();
}

I believe that this is incorrect and the code should also compile when the
method in the Derived class has no ref-qualifier.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-05-03 14:15 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-29 14:48 [Bug c++/100335] New: Using statement of a ref-qualified method from base class: method not callable on derived object 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
2021-05-03  6:38 ` Daniel.Withopf at web dot de
2021-05-03 14:15 ` redi at gcc dot gnu.org

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).