You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// translation C export module M :C;
// translation Uexport module M:U;
import :C;
// translation unit Texport module M;
export import :U; // #1
[module.unit] says
All module partitions of a module that are module interface units shall be directly or indirectly exported by the primary module interface unit ([module.import]). No diagnostic is required for a violation of these rules.
[module.import] p7 says
When a module-import-declaration imports a translation unit T, it also imports all translation units imported by exported module-import-declarations in T; such translation units are said to be exported by T. Additionally, when a module-import-declaration in a module unit of some module M imports another module unit U of M, it also imports all translation units imported by non-exported module-import-declarations in the module unit purview of U. These rules can in turn lead to the importation of yet more translation units.
It is clear that the U is exported by T since an exported module-import-declaration at #1 imports U in T, which is exactly said in the first emphasized part.
Since T and U are module units of M, the second emphasized part should apply to the module-import-declaration at #1, since the non-exported exported module-import-declarationimport :C; appears in U, the module-import-declaration at #1 should also import C. So, C is arguably said that it is indirectly exported by T. All partition module interface units of M are exported by the primary module interface unit of M. There is no violation here.
However, If we compile the example through GCC, it reports an error that:
interface partition is not exported
Not sure whether it is a bug of GCC or [module.unit] falls behind the implementation. Anyway, I think directly or indirectly exported where these adverbs should have their English meanings. U is "directly exported" by T means that U appears in an exported module-import-declaration in T. U is "indirectly exported" by T means that U does not appear in an exported module-import-declaration in T but it is imported by the module-import-declaration.
Wait for the confirmation of the meaning of [module.unit]. If it is a bug in implementations, I will report that bug to the vendors of implementations.
The text was updated successfully, but these errors were encountered:
xmh0511
changed the title
[module.unit] Is “indirectly exported” a design
[module.unit] Is “indirectly exported” a deliberate design?
Jun 15, 2022
This is the editorial issue tracker, not the Q&A forum for C++. If you believe you have found a bug in an implementation, please report that to the vendor. If the vendor believes their implementation is right, but the standard is wrong, they will report a bug against the standard.
This is the editorial issue tracker, not the Q&A forum for C++. If you believe you have found a bug in an implementation, please report that to the vendor. If the vendor believes their implementation is right, but the standard is wrong, they will report a bug against the standard.
I just want to confirm the intent of [module.unit] and [module.import] p7 have been right read here.
When a module-import-declaration imports a translation unit T, it also imports all translation units imported by exported module-import-declarations in T; such translation units are said to be exported by T.
what If there is no such a module-import-declaration that is importing T, it seems to cause confusion here.
Consider this example
[module.unit] says
[module.import] p7 says
It is clear that the
U
is exported byT
since an exported module-import-declaration at#1
importsU
in T, which is exactly said in the first emphasized part.Since
T
andU
are module units ofM
, the second emphasized part should apply to themodule-import-declaration
at#1
, since the non-exported exported module-import-declarationimport :C;
appears inU
, themodule-import-declaration
at#1
should also importC
. So,C
is arguably said that it is indirectly exported byT
. All partition module interface units ofM
are exported by the primary module interface unit ofM
. There is no violation here.However, If we compile the example through
GCC
, it reports an error that:Not sure whether it is a bug of GCC or [module.unit] falls behind the implementation. Anyway, I think directly or indirectly exported where these adverbs should have their English meanings.
U
is "directly exported" byT
means thatU
appears in an exported module-import-declaration inT
.U
is "indirectly exported" byT
means thatU
does not appear in an exported module-import-declaration inT
but it is imported by the module-import-declaration.Wait for the confirmation of the meaning of [module.unit]. If it is a bug in implementations, I will report that bug to the vendors of implementations.
The text was updated successfully, but these errors were encountered: