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

Lambda does not see const integer initialized by constexpr from the enclosed scope #63745

Closed
Fedr opened this issue Jul 7, 2023 · 2 comments
Closed
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" duplicate Resolved as duplicate

Comments

@Fedr
Copy link

Fedr commented Jul 7, 2023

This program

int main() {
    const int i = 0;
    []{
        (void)i;
    }();
}

is accepted by GCC and MSVC, but Clang rejects it with the error:

error: variable 'i' cannot be implicitly captured in a lambda with no capture-default specified

Online demo: https://gcc.godbolt.org/z/jdPjn4Y1d

@EugeneZelenko EugeneZelenko added clang:frontend Language frontend issues, e.g. anything involving "Sema" and removed new issue labels Jul 7, 2023
@llvmbot
Copy link
Member

llvmbot commented Jul 7, 2023

@llvm/issue-subscribers-clang-frontend

@shafik
Copy link
Collaborator

shafik commented Jul 11, 2023

Duplicate: #34603

@shafik shafik closed this as not planned Won't fix, can't repro, duplicate, stale Jul 11, 2023
@shafik shafik added the duplicate Resolved as duplicate label Jul 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" duplicate Resolved as duplicate
Projects
None yet
Development

No branches or pull requests

4 participants