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

disambiguate an odr usage requirement in [basic.def.odr] #1243

Closed
wants to merge 1 commit into from
Closed

disambiguate an odr usage requirement in [basic.def.odr] #1243

wants to merge 1 commit into from

Conversation

ryanhaining
Copy link

@ryanhaining ryanhaining commented Dec 14, 2016

[basic.def.odr] (6.2.1.3)
Coming from: http://stackoverflow.com/questions/41133290 where T.C. asserted that this should be "not odr-used within the definition of D." Otherwise another entity odr-using the constant could break existing definitions non-odr-use. Alternatively this could read "is not odr-used in all definitions of D" but that language seems more ambiguous.

The example code:

static constexpr int CONSTANT = 2;
inline int f() {
  return CONSTANT;
}

If this appears in a header, it could be broken later (by a strict reading of the current language) if anyone, anywhere odr-uses CONSTANT

Coming from: http://stackoverflow.com/questions/41133290 where T.C. asserted that this should be "not odr-used within the definition of D." Otherwise another entity odr-using the constant could break existing definitions non-odr-use. Alternatively this could read "is not odr-used in anl definitions of D" but that language seems more ambiguous.
@zygoloid
Copy link
Member

Identical fix independently created and applied in 5f0f4df.

@zygoloid zygoloid closed this Dec 14, 2016
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

2 participants