[llvm-bugs] [Bug 36880] New: Incorrect -Wunused-lambda-capture warning for this capture

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Mar 23 10:58:51 PDT 2018


            Bug ID: 36880
           Summary: Incorrect -Wunused-lambda-capture warning for this
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: arphaman at gmail.com
                CC: llvm-bugs at lists.llvm.org

$ cat test.cpp

template<class T>
struct DummyTemplate {
    template<class T2>
    void methodTemplate(const T2&){}

    void ToTemplate(const int& param){
        [this](const auto& p){methodTemplate(p);}(param);

int main()
    int i{};
    DummyTemplate<bool> dt;

$ clang test.cpp -std=c++14 -Wunused-lambda-capture
test.cpp:7:10: warning: lambda capture 'this' is not used
        [this](const auto& p){methodTemplate(p);}(param);
test.cpp:15:8: note: in instantiation of member function
'DummyTemplate<bool>::ToTemplate' requested here
1 warning generated.

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/20180323/9eb830db/attachment.html>

More information about the llvm-bugs mailing list