<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 --- - clang++, -Wno-Unused-private-field, and field used in constructor initializer"
   href="http://llvm.org/bugs/show_bug.cgi?id=17238">17238</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang++, -Wno-Unused-private-field, and field used in constructor initializer
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.3
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </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>noloader@gmail.com
          </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>I'm attempting to build Squid using Clang to get analysis tools on the program.
The program configures with -Werror, which should not be a problem.

$ cd squid-3.3.9
$ ./configure --prefix=/usr/local/squid
$ make all CXX='/usr/local/bin/clang++ -fsanitize=address -fsanitize=undefined
-fno-sanitize=vptr' 
...

libtool: compile:  /usr/local/bin/clang++ -fsanitize=address
-fsanitize=undefined -fno-sanitize=vptr -DHAVE_CONFIG_H -I../.. -I../../include
-I../../lib -I../../src -I../../include -I/opt/local/include
-I/opt/local/include -I../../libltdl -I/opt/local/include -I/opt/local/include
-Wall -Wpointer-arith -Wwrite-strings -Wcomments -Werror -pipe -D_REENTRANT -g
-O2 -MT Intercept.lo -MD -MP -MF .deps/Intercept.Tpo -c Intercept.cc 
-fno-common -DPIC -o .libs/Intercept.o
In file included from Intercept.cc:35:
../../src/ip/Intercept.h:146:12: error: private field 'lastReported_' is not
      used [-Werror,-Wunused-private-field]
    time_t lastReported_; /**< Time of last error report. Throttles NAT ...
           ^
1 error generated.
make[3]: *** [Intercept.lo] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1

When I examine Intercept.h, the constructor initializes the filed, so it
appears the variable is used:

    Intercept() : transparentActive_(0), interceptActive_(0), lastReported_(0)
{};

Additionally, specifying -Wno-unused-private-field does not suppress the
warning

I found I can work around with:

    Intercept() : transparentActive_(0), interceptActive_(0), lastReported_(0)
{ (void)lastReported_; };

However, it appears this one-off solution does not scale since there's lots of
these problems.</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>