Skip to content

[dcl.inline] inline specifier is for ODR #8129

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AlisdairM
Copy link
Contributor

@AlisdairM AlisdairM commented Jul 27, 2025

The key use of the inline specifier since C++11, if not before, has been to allow multiple declarations to satisfy the ODR rather than to provide a hint that compilers routinely ignore.

This commit moves but does not change wording, in order to move the comment making the connection with the ODR more prominent than the normative wording suggestings core transformation.

It might be desirable to demote the normative coding hint to a historical footnote, but that goes beyond the remit of a simple editorial change.

\pnum
A variable declaration with an \keyword{inline} specifier declares an
\defnadj{inline}{variable}.

\pnum
The \keyword{inline} specifier shall not appear on a block scope declaration or
Copy link
Member

Choose a reason for hiding this comment

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

If we do some ordering cleanup here at all, we should observe that we traditionally have all (syntax-ish) restrictions first before we dig into semantics. So, this paragraph should be integrated into the existing p1.

Is there any reason why we now define "inline variable" before "inline function", given that the moved note refers to both, and it says "inline function or variable" (in that order)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought about merging p1 and the revised p2 too, but wanted to be conservative before review. Will make that change. Re: order --- I must have been looking at old text before I moved p3 up, as I was sure p1 had variable before function. Will make consistently alphabetical.

The key use of the inline specifier since C++11, if not before,
has been to allow multiple declarations to satisfy the ODR rather
than to provide a hint that compilers routinely ignore.

This change moves but does not change wording, in order to move
the comment making the connection with the ODR more prominent
than the normative wording suggestings core transformation.

It might be desirable to demote the normative coding hint to
a note, but that goes beyond the remit of a simple editorial
chsnge.
@AlisdairM AlisdairM force-pushed the inline_purpose_is_odr branch from 106d000 to 1cbfcde Compare July 27, 2025 20:53
@AlisdairM
Copy link
Contributor Author

Further consolidated text per suggestion above.
Moved Comment 2 about inline not affecting linkage up to the end of p1 as well.

@AlisdairM AlisdairM requested a review from jensmaurer July 27, 2025 20:55
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.

2 participants