Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[module.reach] Remove redundant module implementation unit declaration #5510

Merged
merged 1 commit into from Sep 8, 2022

Conversation

ChuanqiXu9
Copy link
Contributor

I found this one when trying to implement [module.reach]. The problem here is that when the compiler see the module implementation unit declaration, the compiler would try to find the primary module interface. However, the primary module interface doesn't exist in the example.

Even we don't care the implementation details, it looks problematic from the perspective of language. According to [module.unit]p2 (https://eel.is/c++draft/module.unit#2):

A module interface unit is a module unit whose module-declaration starts with export-keyword; any other module unit is a module implementation unit. A named module shall contain exactly one module interface unit with no module-partition, known as the primary module interface unit of the module; no diagnostic is required.

But the example doesn't contain a primary module interface for module X and module B. So the example is problematic. Comparing to add the primary module interface, I think it is simpler to remove them simply.

@jensmaurer
Copy link
Member

@zygoloid , could you have a look, please?

Copy link
Member

@zygoloid zygoloid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me, these multi-TU examples should be complete and currently aren't.

@tkoeppe tkoeppe merged commit 37d46b0 into cplusplus:main Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants