[LLVMbugs] [Bug 17014] New: -Wunsused_variable gives false positive for template

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Aug 27 12:45:56 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=17014

            Bug ID: 17014
           Summary: -Wunsused_variable gives false positive for template
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: artur at ebasoft.com.pl
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

clang version 3.4 (trunk 189329)
Target: x86_64-unknown-linux-gnu
Thread model: posix

#include <iostream>
#include <string>

struct bar {
  int value;
};

struct foo {
  foo( bar & b, int x) 
    {
    b.value = x;
    }
};
template<typename T>
struct baz {
  void operator()(bar & b, T argc) const
  {
  foo false_positive_unsused_variable(b,argc);
  std::cout << "Result is "<< b.value << std::endl;
  }
};

int main(int argc, char **argv) {
  bar b;
  baz<int> z;
  z(b, argc);

    return 0;
}

clang++    -Wunused-variable -O3 -DNDEBUG   -o
CMakeFiles/clang_test.dir/main.cpp.o -c
/home/artur/projects/clang_test/main.cpp
/home/artur/projects/clang_test/main.cpp:18:7: warning: unused variable
'false_positive_unsused_variable'
      [-Wunused-variable]
  foo false_positive_unsused_variable(b,argc);
      ^


I've checked 
http://llvm.org/bugs/show_bug.cgi?id=9968
that one is fixed.

But it colud be connected with
http://llvm.org/bugs/show_bug.cgi?id=15532

-- 
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/20130827/96086ab2/attachment.html>


More information about the llvm-bugs mailing list