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

            Bug ID: 84832
           Summary: Base class member function incorrectly introduced by
                    using-declarator
           Product: gcc
           Version: 7.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jaak at ristioja dot ee
  Target Milestone: ---

struct Base {
    template <typename T, int = 42>
    void f(T &&) const {}
};

struct Derived: Base {
    template <typename T, typename X = typename T::asdf>
    void f(T &&) const {}

    using Base::f;
};

int main() {
    Derived const cd;
    cd.f('x');
}

The following compiles fine with GCC and -std=c++11, but not with Clang. User
liliscent over at https://stackoverflow.com/q/49235124/3919155 thinks this is a
GCC bug, because Base::f should not be introduced by the using-declarator
because of [namespace.udecl]:

> When a using-declarator brings declarations from a
> base class into a derived class, member functions
> and member function templates in the derived class
> override and/or hide member functions and member
> function templates with the same name, parameter-
> type-list, cv-qualification, and ref-qualifier (if
> any) in a base class (rather than conflicting).
> Such hidden or overridden declarations are excluded
> from the set of declarations introduced by the
> using-declarator.

Reply via email to