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

p2579r0 vs. https://eel.is/c++draft/basic.scope#block-2 CWG2838 #6536

Open
jakubjelinek opened this issue Aug 30, 2023 · 2 comments
Open

p2579r0 vs. https://eel.is/c++draft/basic.scope#block-2 CWG2838 #6536

jakubjelinek opened this issue Aug 30, 2023 · 2 comments
Labels
cwg Issue must be reviewed by CWG. not-editorial Issue is not deemed editorial; the editorial issue is kept open for tracking.

Comments

@jakubjelinek
Copy link

Is

void foo () {
  auto f = [i = 5] () { int i; return 0; };
}

supposed to be valid after the P2579R0 changes? Before that paper and before P2036R3 this wouldn't be valid, because
the capture inhabited the same scope as int i; P2036R3 changed it to inhabit the parameter scope, so parent scope of it
and then https://eel.is/c++draft/basic.scope#block-2 triggered there. But P2579R0 says that the init capture inhabits
lambda scope and isn't that the parent scope of the parameter scope, i.e. grandparent scope of the lambda's compound statement's scope?

@jakubjelinek
Copy link
Author

jakubjelinek commented Aug 31, 2023

And for auto f = [i = 5] <int N> () { int i; return 0; }; it is even grand-grandparent scope.

@jensmaurer jensmaurer added cwg Issue must be reviewed by CWG. not-editorial Issue is not deemed editorial; the editorial issue is kept open for tracking. labels Dec 13, 2023
@jensmaurer jensmaurer changed the title p2579r0 vs. https://eel.is/c++draft/basic.scope#block-2 p2579r0 vs. https://eel.is/c++draft/basic.scope#block-2 CWG2838 Dec 13, 2023
@jensmaurer
Copy link
Member

CWG2838

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cwg Issue must be reviewed by CWG. not-editorial Issue is not deemed editorial; the editorial issue is kept open for tracking.
Projects
None yet
Development

No branches or pull requests

2 participants