cplusplus / cplusplus/draft

[basic.def.odr] "Lambda scope" should be included as a possible "intervening scope" in definition of "odr-usable"

Open
#6,739 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TeX
Stars
221
Forks
813
Avg merge
16h 4m
Merged PRs (30d)
36

Description

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!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with [basic.def.odr] paragraph 10 in the C++ draft, especially the definition of an odr-usable local entity and its intervening scopes. Compare the listed block and lambda function parameter scopes with the lambda, function parameter, and block scopes introduced by a lambda expression. Done means resolving whether lambda scope belongs in the definition and updating the wording if required.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, tex
Domain
compilers, documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.