[llvm-bugs] [Bug 35239] extern template classes, clang produces object code with 1 weak symbol, but ld gives undefined reference (ld accepts gcc object code)

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Nov 8 10:27:51 PST 2017


https://bugs.llvm.org/show_bug.cgi?id=35239

David Blaikie <dblaikie at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |dblaikie at gmail.com
         Resolution|---                         |INVALID

--- Comment #2 from David Blaikie <dblaikie at gmail.com> ---
The program you have appears to be ill-formed, though no diagnostic is required
to be produced by the implementation.

C++17, [temp.explicit]p11 states:

"An entity that is the subject of an explicit instantiation declaration and
that is also used in a way that would otherwise cause an implicit instantiation
(17.7.1) in the translation unit shall be the subject of an explicit 
instantiation definition somewhere in the program;"

& your program has an explicit instantiation declaration:

  extern template class demo<int>;

But doesn't appear to have a corresponding explicit instantiation definition:

  template class demo<int>;

Anywhere.

-- 
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/20171108/292fedf0/attachment.html>


More information about the llvm-bugs mailing list