[LLVMbugs] [Bug 14733] New: Warn on unused file-scoped templates

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Dec 28 09:03:25 PST 2012


             Bug #: 14733
           Summary: Warn on unused file-scoped templates
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Keywords: googler
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: dblaikie at gmail.com
                CC: chandlerc at gmail.com, dgregor at apple.com,
                    llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Clang currently warns on unused file-scoped entities like:

  static void func(int) { }

but does not warn on unused file-scoped templates like:

  template<typename T>
  static void func(T) { }

I assume this is because Clang's -Wunused is powered by similar/the same logic
as is used to choose which symbols to emit in CodeGen. Templates aren't,
themselves, emittable symbols in that sense, so we don't warn about them.

What we should do is warn about any file-scoped (class or function) template
with no specializations.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list