<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - false positive for -Wunused-member-function when in anonymous namespace"
href="https://bugs.llvm.org/show_bug.cgi?id=32046">32046</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>false positive for -Wunused-member-function when in anonymous namespace
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.9
</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>enhancement
</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>weiss@wsoptics.de
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Compiling the following code with -Wunused-member-function results in two
warnings. Removing the anonymous namespace around the definition of class
Iterator makes the warnings go away.
#include <iostream>
#include <iterator>
#include <boost/iterator/iterator_categories.hpp>
#include <boost/iterator/iterator_facade.hpp>
namespace {
class Iterator : public boost::iterator_facade<Iterator, std::size_t
const, boost::bidirectional_traversal_tag>
{
public:
Iterator() : pos_(0) {}
std::size_t dereference() const { return pos_; }
bool equal(Iterator const & other) const { return pos_ ==
other.pos_; }
void increment() { ++pos_; }
void decrement() { --pos_; }
private:
friend class boost::iterator_core_access;
std::size_t pos_;
};
}
int main()
{
Iterator i;
std::cout << "i = " << *i << '\n';
return 0;
}</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>