[Bug c++/78308] New: Hiding of member function templates introduced by using-decl

gcc@axel-naumann.de gcc-bugzilla@gcc.gnu.org
Fri Nov 11 10:00:00 GMT 2016


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

            Bug ID: 78308
           Summary: Hiding of member function templates introduced by
                    using-decl
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc@axel-naumann.de
  Target Milestone: ---

Hi,

struct A {
  template <class T> auto func(T t) -> decltype(T::member);
};

struct B: A {
  using A::func;
  template <class T> auto func(T t) -> decltype(T::other);
};

struct P { int member; };

void call(B b, P p) {
  b.func(p);
}


GCC accepts this; ICC and clang reject this, refusing to introduce A::func in
B. See also [namespace.udecl](15):

"When a using-declaration 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 (8.3.5),
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-declaration."

Cheers, Axel.


More information about the Gcc-bugs mailing list