[LLVMbugs] [Bug 20593] link success with static template member depends on optimisation level

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Aug 8 10:31:56 PDT 2014


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

David Majnemer <david.majnemer at gmail.com> changed:

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

--- Comment #1 from David Majnemer <david.majnemer at gmail.com> ---
You never provide a definition of your static member.

Adding a definition would make your program successfully link:

template <class T>
T foo<T>::static_member = T();

As to why it works when optimizations are applied: the optimizer realizes you
aren't using the 'static_member' variable and optimizes away the references to
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/20140808/e092a814/attachment.html>


More information about the llvm-bugs mailing list