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

            Bug ID: 106851
           Summary: [modules] Name conflict for exported using-declaration
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
            Blocks: 103524
  Target Milestone: ---

$ cat lib.h
namespace outer {
  template<typename T> void any_of(T) { }

  namespace inner {
    struct A { };
    inline constexpr A any_of;
  }
}

$ gcc -c -std=c++23 -fmodules-ts -x c++-header lib.h


$ cat lib.cc
export module lib;

import "lib.h";

export using outer::any_of;
export using outer::inner::any_of;


$ gcc -c -std=c++23 -fmodules-ts lib.cc 
lib.cc:6:28: error: ‘constexpr const outer::inner::A outer::inner::any_of’
conflicts with a previous declaration
    6 | export using outer::inner::any_of;
      |                            ^~~~~~
In module ./lib.h, imported at lib.cc:3:
lib.h:2:29: note: previous declaration ‘void outer::any_of(T)’
    2 |   template<typename T> void any_of(T) { }
      |                             ^~~~~~
lib.cc:1:8: warning: not writing module ‘lib’ due to errors
    1 | export module lib;
      |        ^~~~~~


The names are in different scopes, shouldn't they be exported that way too?


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103524
[Bug 103524] [meta-bug] modules issue

Reply via email to