[LLVMbugs] [Bug 18733] New: Bogus warning with -Wweak-template-vtables

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Feb 4 22:00:19 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=18733

            Bug ID: 18733
           Summary: Bogus warning with -Wweak-template-vtables
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rafael.espindola at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Given

---------------------------
template<typename T>
class foo {
  virtual ~foo() {}
};

extern template class foo<int>;
template class foo<int>;
----------------------------

clang warns:
-------------------------------
test.cpp:6:23: warning: explicit template instantiation 'foo<int>' will emit a
vtable in every translation unit [-Wweak-template-vtables]
extern template class foo<int>;
                      ^
1 warning generated.
------------------------------

note that the warning points to the explicit template instantiation
declaration, but is triggered by the definition. This should probably be
checking if the definition is in a header. In a .cpp file there is only one
translation unit that sees it.

-- 
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/20140205/38ffddd9/attachment.html>


More information about the llvm-bugs mailing list