<html>
    <head>
      <base href="https://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 --- - Don't warn on -Wunused-const-variable when the variable comes from a template specialization in a macro."
   href="https://llvm.org/bugs/show_bug.cgi?id=28878">28878</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Don't warn on -Wunused-const-variable when the variable comes from a template specialization in a macro.
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>richard-llvm@metafoo.co.uk
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>zturner@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, rtrieu@google.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>// Foo.h

template<typename T> struct Foo {};

#define SPECIALIZE_SOME_FOOS(_type)                \
   template <> struct Foo<std::vector<_type>> {    \
      static const bool F = true;                  \
   };                                              \
   template <> struct Foo<SmallVector<_type>> {    \
      static const bool B = true;                  \
   };

// Foo.cpp

namespace {
  typedef int MyType;
}

SPECIALIZE_SOME_FOOS(MyType)

These will warn on -Wunused-const-variable because the compiler can see all
possible uses MyType and determine that the template instantiation can never be
used.  While technically correct, it might be a little too aggressive to warn
on this, especially when the template specializations come from a macro which
someone might design for simplicity to declare many possible specializations of
a class, of which a person might choose to rely on only a subset.</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>