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

[basic.def.odr] p10 What does function definition scope mean in this current draft? #5406

Open
xmh0511 opened this issue Apr 21, 2022 · 6 comments

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented Apr 21, 2022

[basic.def.odr] p10 says

where *this is considered to be introduced within the innermost enclosing class or non-lambda function definition scope

And the comment in the example after this rule also refers to "function definition scope"

error: n is not odr-usable due to intervening function definition scope

In the subclause [basic.scope], we do not define "function definition scope", we just have function parameter scope. Does "function definition scope" intend to refer to function parameter scope instead?

@jensmaurer
Copy link
Member

@opensdh , replacing this with "function parameter scope" sounds reasonable. What do you think?

@opensdh
Copy link
Contributor

opensdh commented Apr 21, 2022

The example plainly thinks that there is some distinction (compare A::f to g), but C++20 didn't have any such scope defined either, so I'm pretty sure it's fine to make this change.

@frederick-vs-ja
Copy link
Contributor

The term "function definition scope" is introduced via P0588R1 and not defined or used elsewhere.

@zygoloid, what's the meaning of "function definition scope"?

@xmh0511
Copy link
Contributor Author

xmh0511 commented Apr 24, 2022

@frederick-vs-ja "function definition scope" had been removed in P1787. P1787 seems to be invented after P0588R1?

@frederick-vs-ja
Copy link
Contributor

"function definition scope" had been removed in P1787.

Not true. P1787 didn't touch "function definition scope" (you can check P1787R6 and EDIT4398).

The (only two) occurences of "function definition scope" in the draft haven't been changed since their introduction (contained in N4713).

@xmh0511
Copy link
Contributor Author

xmh0511 commented Apr 25, 2022

Yes, you're right. I just remembered it wrong. Except that "function definition scope" appears in [basic.def.odr] p10, it doesn't appear in other subclauses anymore. If I remember correctly, "function definition scope" hasn't been defined since c++17(or earlier version). From the literal meaning, it intends to refer to a function parameter scope, which contains any scope introduced in the function definition.

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

No branches or pull requests

4 participants