[Bug c++/104476] New: using-decl shadowed by member function when in incomplete-class context

ppalka at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Feb 9 19:40:21 GMT 2022


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

            Bug ID: 104476
           Summary: using-decl shadowed by member function when in
                    incomplete-class context
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ppalka at gcc dot gnu.org
  Target Milestone: ---

We reject the following valid testcase:

struct A {
  static void f();
};

struct B : A
{
  using A::f;         // #1
  static void f(int); // #2
  auto g() -> decltype(f());  // Call should be accepted via #1, instead
rejected
};

with

<stdin>:9:25: error: no matching function for call to ‘B::f()’
<stdin>:8:15: note: candidate: ‘static void B::f(int)’
<stdin>:8:15: note:   candidate expects 1 argument, 0 provided
<stdin>:9:25: error: no matching function for call to ‘B::f()’
<stdin>:8:15: note: candidate: ‘static void B::f(int)’
<stdin>:8:15: note:   candidate expects 1 argument, 0 provided

Yet if we swap the order of the declarations #1 and #2, then we accept the
testcase.


More information about the Gcc-bugs mailing list