[Clang] Lambda parameter shadowing a field while using explicit object parameter (original) (raw)

Skip to content

Sign in

Appearance settings

View all features

View all solutions

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Sign in

Sign up

Appearance settings

llvm / llvm-project Public

Additional navigation options

New issue

New issue

Closed

Bug

#165919

Closed

[Clang] Lambda parameter shadowing a field while using explicit object parameter

#163731

Bug

#165919

Labels

clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerconfirmedVerified by a second partyfalse-positiveWarning fires when it should notlambdaC++11 lambda expressions

@exdal

Description

@exdal

exdal

opened

on Oct 16, 2025

struct Foo { int bar;

void func(this Foo &self) {
    auto lambda = [](int bar) {
        return bar;
    };
}

};

:5:30: warning: declaration shadows a field of 'Foo' [-Wshadow-uncaptured-local] 5 | auto lambda = [](int bar) { | ^ :2:9: note: previous declaration is here 2 | int bar; | ^

https://godbolt.org/z/d7vjvP79q

Metadata

Metadata

Assignees

No one assigned

Labels

clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerconfirmedVerified by a second partyfalse-positiveWarning fires when it should notlambdaC++11 lambda expressions

Type

Bug

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions