[PATCH] D140927: [C++20][Modules] Fix named module import diagnostics.
Iain Sandoe via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 4 01:10:29 PST 2023
iains added a comment.
In D140927#4024648 <https://reviews.llvm.org/D140927#4024648>, @ChuanqiXu wrote:
> [module.import]p1 says:
>
>> In a module unit, all module-import-declarations and export-declarations exporting module-import-declarations shall appear before all other declarations in the declaration-seq of the translation-unit and of the private-module-fragment (if any).
>
> So the following case is invalid:
>
> //--- b.hpp
> void func() {}
> import a;
>
> //--- c.cpp
> module;
> #include "b.hpp"
> export module c;
>
> I feel we'd better to address such cases in the test.
I am not sure about this - what you are suggesting above would seem to make modules useless when there is a GMF (since there is almost no point to having a GMF that has no decls).
https://eel.is/c++draft/basic.link#1
Make the declaration-see of a module unit specifically follow the module keyword.
https://eel.is/c++draft/module#import-1 (which you quoted from above) makes adds to this the PMF - but I do not see that it includes the GMF (since that is neither the declaration-seq of the module unit nor is it the PMF.
(this + 15.5 named Header Unit import is why the original bug is there .. )
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D140927/new/
https://reviews.llvm.org/D140927
More information about the cfe-commits
mailing list