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] "Lambda scope" should be included as a possible "intervening scope" in definition of "odr-usable" #6739

Open
RazvanAM opened this issue Dec 19, 2023 · 0 comments

Comments

@RazvanAM
Copy link

Hello,

[basic.def.odr] p. 10 states that:

A local entity is odr-usable in a scope if:

  • either the local entity is not *this, or an enclosing class or non-lambda function parameter scope exists and, if the innermost such scope is a function parameter scope, it corresponds to a non-static member function, and
  • for each intervening scope ([basic.scope.scope]) between the point at which the entity is introduced and the scope (where *this is considered to be introduced within the innermost enclosing class or non-lambda function definition scope), either:
    • the intervening scope is a block scope, or
    • the intervening scope is the function parameter scope of a lambda-expression that has a simple-capture naming the entity or has a capture-default, and the block scope of the lambda-expression is also an intervening scope.

I believe a lambda expression introduces three nested scopes, in this order: a lambda scope, a function parameter scope and a block scope.
Shouldn't the lambda scope introduced by the lambda expression be allowed to be one of the intervening scopes in the definition of "odr-usable"?

Thank you!

@RazvanAM RazvanAM changed the title [basic.def.odr] "Lambda scope" should be included as a possible "intervening scope" [basic.def.odr] "Lambda scope" should be included as a possible "intervening scope" in definition of "odr-usable" Dec 19, 2023
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

1 participant