<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - -Wunsused_variable gives false positive for template"
href="http://llvm.org/bugs/show_bug.cgi?id=17014">17014</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>-Wunsused_variable gives false positive for template
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>artur@ebasoft.com.pl
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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
<a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - False positive "unused variable '__range'" with ranged for loop in template"
href="show_bug.cgi?id=9968">http://llvm.org/bugs/show_bug.cgi?id=9968</a>
that one is fixed.
But it colud be connected with
<a class="bz_bug_link
bz_status_NEW "
title="NEW --- - False positive for -Wunused-variable in function template when calling nontrivial ctor with __func__"
href="show_bug.cgi?id=15532">http://llvm.org/bugs/show_bug.cgi?id=15532</a></pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>