<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 --- - Spurious -Wunneeded-internal-declaration warnings for separate compilation"
   href="http://llvm.org/bugs/show_bug.cgi?id=17340">17340</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Spurious -Wunneeded-internal-declaration warnings for separate compilation
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>All
          </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>akim.demaille@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>In the following example, I get a warning with separate compilation, although
the function will be useful where the type foo is really instantiated.

$ cat foo.cc
#include <cstdlib>

static int debug_level()
{
  return !!getenv("DEBUG");
};

template <typename T>
struct foo
{
  foo() : debug_(debug_level()) {}
  int debug_;
};
$ clang++-mp-3.3 -Wall /tmp/foo.cc -c
/tmp/foo.cc:3:12: warning: function 'debug_level' is not needed and will not be
emitted
      [-Wunneeded-internal-declaration]
static int debug_level()
           ^
1 warning generated.
$ clang++-mp-3.3 --version
clang version 3.3 (tags/RELEASE_33/final)
Target: x86_64-apple-darwin12.5.0
Thread model: posix</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>