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

            Bug ID: 116160
           Summary: Rejects repeated using-declaration `using A::x;`
                    [namespace.udecl]
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: arthur.j.odwyer at gmail dot com
  Target Milestone: ---

// https://godbolt.org/z/fG1ofMq65
namespace Blah { int b; }
int main() {
  using Blah::b;
  using Blah::b;
}

// https://godbolt.org/z/dbKfKG766
enum class Blah { b };
int main() {
  using Blah::b;
  using Blah::b;
}

In both cases, GCC complains:

<source>:7:15: error: redeclaration of 'int Blah::b'
    7 |   using Blah::b;
      |               ^

<source>:7:15: error: redeclaration of 'Blah Blah::b'
    7 |   using Blah::b;
      |               ^

But https://eel.is/c++draft/namespace.udecl#example-8 is very clear that the
former must be accepted; and I believe the latter also must be accepted.
(Clang+MSVC accept in both cases.) Redeclarations of using-declarations are OK.


This also affects GCC's handling of `using enum Blah`, as noticed by Sean
Baxter on the cpplang Slack:

  using Blah::b;
  using enum Blah; // GCC rejects, should accept

Reply via email to