[llvm-bugs] [Bug 38354] Clang-cl generates more code, in this case the Dtor. Resulting in link errors

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jul 30 10:34:24 PDT 2018


Reid Kleckner <rnk at google.com> changed:

           What    |Removed                     |Added
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED

--- Comment #1 from Reid Kleckner <rnk at google.com> ---
This links successfully without optimizations, but fails with optimizations.

With optimizations, LLVM discards the definition of A<int>::~A in t.obj after
inlining. This is normal for inline functions. Every TU that needs the
definition of an inline function must provide one. This rule exists to allow
each TU to individually discard inline function definitions that are not

MSVC implements this optimization under /Zc:inline
(https://msdn.microsoft.com/en-us/library/dn642448.aspx), but it is not on by
default for compatibility with code like this.

To fix the code, move the template method definitions into the .h file.

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/20180730/b2c5360b/attachment-0001.html>

More information about the llvm-bugs mailing list