@@ -345,6 +345,9 @@ In case all ``-fprebuilt-module-path=<path/to/directory>``, ``-fmodule-file=<pat
345345takes highest precedence and ``-fmodule-file=<module-name>=<path/to/BMI> `` will take the second
346346highest precedence.
347347
348+ We need to specify all the dependent (directly and indirectly) BMIs.
349+ See https://github.com/llvm/llvm-project/issues/62707 for detail.
350+
348351When we compile a ``module implementation unit ``, we must specify the BMI of the corresponding
349352``primary module interface unit ``.
350353Since the language specification says a module implementation unit implicitly imports
@@ -689,14 +692,68 @@ the BMI within ``clang-cl.exe``.
689692
690693This is tracked in: https://github.com/llvm/llvm-project/issues/64118
691694
692- delayed template parsing is not supported/broken with C++ modules
693- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
695+ false positive ODR violation diagnostic due to using inconsistent qualified but the same type
696+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
697+
698+ ODR violation is a pretty common issue when using modules.
699+ Sometimes the program violated the One Definition Rule actually.
700+ But sometimes it shows the compiler gives false positive diagnostics.
701+
702+ One often reported example is:
703+
704+ .. code-block :: c++
705+
706+ // part.cc
707+ module;
708+ typedef long T;
709+ namespace ns {
710+ inline void fun() {
711+ (void)(T)0;
712+ }
713+ }
714+ export module repro:part;
715+
716+ // repro.cc
717+ module;
718+ typedef long T;
719+ namespace ns {
720+ using ::T;
721+ }
722+ namespace ns {
723+ inline void fun() {
724+ (void)(T)0;
725+ }
726+ }
727+ export module repro;
728+ export import :part;
729+
730+ Currently the compiler complains about the inconsistent definition of `fun() ` in
731+ 2 module units. This is incorrect. Since both definitions of `fun() ` has the same
732+ spelling and `T ` refers to the same type entity finally. So the program should be
733+ fine.
734+
735+ This is tracked in https://github.com/llvm/llvm-project/issues/78850.
736+
737+ Using TU-local entity in other units
738+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
739+
740+ Module units are translation units. So the entities which should only be local to the
741+ module unit itself shouldn't be used by other units in any means.
742+
743+ In the language side, to address the idea formally, the language specification defines
744+ the concept of ``TU-local `` and ``exposure `` in
745+ `basic.link/p14 <https://eel.is/c++draft/basic.link#14 >`_,
746+ `basic.link/p15 <https://eel.is/c++draft/basic.link#15 >`_,
747+ `basic.link/p16 <https://eel.is/c++draft/basic.link#16 >`_,
748+ `basic.link/p17 <https://eel.is/c++draft/basic.link#17 >`_ and
749+ `basic.link/p18 <https://eel.is/c++draft/basic.link#18 >`_.
694750
695- The feature `-fdelayed-template-parsing ` can't work well with C++ modules now.
696- Note that this is significant on Windows since the option will be enabled by default
697- on Windows.
751+ However, the compiler doesn't support these 2 ideas formally.
752+ This results in unclear and confusing diagnostic messages.
753+ And it is worse that the compiler may import TU-local entities to other units without any
754+ diagnostics.
698755
699- This is tracked in: https://github.com/llvm/llvm-project/issues/61068
756+ This is tracked in https://github.com/llvm/llvm-project/issues/78173.
700757
701758Header Units
702759============
0 commit comments