[LLVMbugs] [Bug 23177] static char strange linker error

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Apr 9 13:20:32 PDT 2015


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

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> ---
Hi Daniel,

Your program is invalid because you don't specify a definition of
Foo::Something.

You need something like the following in at least one translation unit:
const char Something::Foo;

The reason why you are observing different behavior between 'char' and
'unsigned char' is due to the fact that your static data member is ODR-used in
the operator[] of the map because the map takes a char& parameter.  When you
change the static data member's type to 'unsigned char', you instead get a
temporary created of the appropriate type and have it's address passed to the
map.

-- 
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/20150409/a9c400e2/attachment.html>


More information about the llvm-bugs mailing list