[llvm-bugs] [Bug 28878] New: Don't warn on -Wunused-const-variable when the variable comes from a template specialization in a macro.
    via llvm-bugs 
    llvm-bugs at lists.llvm.org
       
    Fri Aug  5 16:58:07 PDT 2016
    
    
  
https://llvm.org/bugs/show_bug.cgi?id=28878
            Bug ID: 28878
           Summary: Don't warn on -Wunused-const-variable when the
                    variable comes from a template specialization in a
                    macro.
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: richard-llvm at metafoo.co.uk
          Reporter: zturner at google.com
                CC: llvm-bugs at lists.llvm.org, rtrieu at google.com
    Classification: Unclassified
// 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.
-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160805/55a1e272/attachment.html>
    
    
More information about the llvm-bugs
mailing list