<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [modules] name clashes with non-included libraries"
   href="https://bugs.llvm.org/show_bug.cgi?id=32192">32192</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[modules] name clashes with non-included libraries
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Modules
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>gonzalobg88@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I am trying to compile a binary that uses range-v3 as a library, using
-fmodules with implicit modules enabled and my own module.modulemap file for my
code. 

Under MacOSX the following directory is in my include path
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/
because I want to use the POSIX headers. 

That directory has a module.modulemap file that defines an ncurses modules
which included the curses.h header. 

The problem:

- ncurses exports a type named meta

- range-v3 has a namespace named meta

Both clash, even though I am not including the ncurses.h headers anywhere.

If I opt-out of implicit modules and define my own module.modulemap files, I
can compile my code fine, but I don't get to reuse any of the definitions in
the /Applications/..../SDK/include/module.modulemap above for the libraries I
actually want to use (like the posix headers). 

What's the correct way to solve this issue?

Why is clang importing the ncurses library if none of my code is including it?

In particular, the error message I get is:

While building module 'hm3_utility_mpi' imported from
/Users/gnzlbg/projects/hm3/test/hm3/utility/mpi.cpp:4:
While building module 'hm3_utility_mpi_comm' imported from
/Users/gnzlbg/projects/hm3/include/hm3/utility/mpi.hpp:6:
While building module 'hm3_utility_fmt' imported from
/Users/gnzlbg/projects/hm3/include/hm3/utility/mpi/comm.hpp:5:
While building module 'hm3_utility_ref' imported from
/Users/gnzlbg/projects/hm3/include/hm3/utility/fmt.hpp:6:
While building module 'hm3_utility_range' imported from
/Users/gnzlbg/projects/hm3/include/hm3/utility/ref.hpp:5:
While building module 'hm3_ext_range_v3' imported from
/Users/gnzlbg/projects/hm3/include/hm3/utility/range.hpp:6:
In file included from <module-includes>:1:
In file included from
/Users/gnzlbg/projects/hm3/include/hm3/ext/range-v3.hpp:16:
In file included from
/Users/gnzlbg/projects/hm3/modules_build/src/range-v3/include/range/v3/all.hpp:17:
In file included from
/Users/gnzlbg/projects/hm3/modules_build/src/range-v3/include/range/v3/core.hpp:17:
In file included from
/Users/gnzlbg/projects/hm3/modules_build/src/range-v3/include/range/v3/begin_end.hpp:21:
In file included from
/Users/gnzlbg/projects/hm3/modules_build/src/range-v3/include/range/v3/range_fwd.hpp:20:
In file included from
/Users/gnzlbg/projects/hm3/modules_build/src/range-v3/include/meta/meta.hpp:20:
/Users/gnzlbg/projects/hm3/modules_build/src/range-v3/include/meta/meta_fwd.hpp:36:11:
error: redefinition of 'meta' as different kind of symbol
namespace meta
          ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/curses.h:603:28:
note: previous definition is here
extern NCURSES_EXPORT(int) meta (WINDOW *,bool);                        /*
implemented */


But the error does not pinpoint any location that includes the curses.h header.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>