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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to