[LLVMbugs] [Bug 21426] New: -Wshadow warns on non captured lambda parameters

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Oct 31 02:58:11 PDT 2014


            Bug ID: 21426
           Summary: -Wshadow warns on non captured lambda parameters
           Product: clang
           Version: 3.3
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: christof.donat at ppro.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 13261
  --> http://llvm.org/bugs/attachment.cgi?id=13261&action=edit
C++ code that shows the bug

Consider the attached code. In this case the parameter argv to main() can not
be considered inside the lambda as a resolution of the name argv, because the
lambda does not capture it. Yet clang++ complains:

$ clang++ test.cpp -std=c++11 -Wshadow
test.cpp:16:40: warning: declaration shadows a local variable [-Wshadow]
                concat_params([](int i, const char** argv) -> std::string {
return argv[i]; }, argc, argv) <<
test.cpp:13:34: note: previous declaration is here
auto main(int argc, const char** argv) -> int
1 warning generated.

For details:
$ clang++ --version
FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610
Target: x86_64-unknown-freebsd10.0
Thread model: posix

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20141031/02d98b49/attachment.html>

More information about the llvm-bugs mailing list