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.private.frag] Remove misleading example and broaden note #5537

Merged
merged 1 commit into from Aug 18, 2022

Conversation

jensmaurer
Copy link
Member

@zygoloid, this addresses http://lists.isocpp.org/ext/2022/06/19564.php

Note that the example believes that fn_m (module linkage) is ok, but [dcl.inline] p7 makes no distinction between external and module linkage (both fn_e and fn_m are attached to the named module "A", I believe):

If an inline function or variable that is attached to a named module is declared in a definition domain, it shall be defined in that domain.

@jensmaurer jensmaurer requested a review from zygoloid June 23, 2022 21:19
@@ -827,12 +827,11 @@
export module A;
export inline void fn_e(); // error: exported inline function \tcode{fn_e} not defined
// before private module fragment
inline void fn_m(); // OK, module-linkage inline function
inline void fn_m(); // error: module-linkage inline function \tcode{fn_m} not defined
Copy link
Member

Choose a reason for hiding this comment

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

Maybe:

Suggested change
inline void fn_m(); // error: module-linkage inline function \tcode{fn_m} not defined
inline void fn_m(); // error: non-exported inline function \tcode{fn_m} not defined
// before private module fragment

The current comment makes it sound like the linkage matters here, and it doesn't; making this parallel the prior comment might make it clearer that exportedness doesn't matter either?

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed, fixed.

This comment was marked as resolved.

This comment was marked as outdated.

@jensmaurer
Copy link
Member Author

@tkoeppe, this seems ready.

See also endorsement by @zygoloid here: https://lists.isocpp.org/ext/2022/06/19578.php

@tkoeppe
Copy link
Contributor

tkoeppe commented Jun 27, 2022

Thanks. Has your later concern been addressed adequately by the response in http://lists.isocpp.org/ext/2022/06/19578.php?

@xmh0511
Copy link
Contributor

xmh0511 commented Jul 12, 2022

This PR seems to fix #4890. Confusion is that [dcl.inline] p7 says

If an inline function or variable that is attached to a named module is declared in a definition domain, it shall be defined in that domain.

Does "that domain" refer to the lexical portion where the inline function or variable is declared or to any same kind of definition domain that can appear in other translation units? Presumably, it means

If an inline function or variable that is attached to a named module is declared in a definition domain, it shall be defined in that domain of that translation unit.

The comment will be helpful if it is:

// error: the inline function is not defined in this domain([dcl.inline])

Since [dcl.inline] unified apply to all inline functions and variables as long as they are attached to a named module, whether the function is exported or non-exported is not significant here, I think.

@jensmaurer
Copy link
Member Author

As explained in #5561, "definition domain" is clearly defined lexically ("portion of a translation unit"), so I think there is no remaining issue.

Even if there were, it could be addressed separately at a later time.

@tkoeppe
Copy link
Contributor

tkoeppe commented Aug 18, 2022

(And this only changes a note/example anyway.)

@tkoeppe tkoeppe merged commit 99bc532 into cplusplus:main Aug 18, 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

5 participants