r237787 - [MSVC] Handle out-of-line definition of static data member correctly (fix for http://llvm.org/PR21164), by Alexey Frolov
hans at chromium.org
Wed May 20 09:54:20 PDT 2015
On Wed, May 20, 2015 at 9:26 AM, Hans Wennborg <hans at chromium.org> wrote:
> On Wed, May 20, 2015 at 4:57 AM, Alexey Bataev <a.bataev at hotmail.com> wrote:
>> Author: abataev
>> Date: Wed May 20 06:57:02 2015
>> New Revision: 237787
>> URL: http://llvm.org/viewvc/llvm-project?rev=237787&view=rev
>> [MSVC] Handle out-of-line definition of static data member correctly (fix for http://llvm.org/PR21164), by Alexey Frolov
>> There are 3 cases of defining static const member:
>> initialized inside the class, not defined outside the class.
>> initialized inside the class, defined outside the class.
>> not initialized inside the class, defined outside the class.
> Chromium always has another case :-) See .
> It seems  is both initialized inside the class and defined outside
> the class, but with __declspec(selectany) to appease MSVC as suggested
> by . When compiled with clang-cl, we now get a multiple definition
> error during linking. We can fix the code in Chromium of course, but
> maybe others will run into the same problem?
> . http://build.chromium.org/p/chromium.fyi/builders/CrWinClang%28dbg%29/builds/441/steps/compile/logs/stdio
>  https://code.google.com/p/chromium/codesearch#chromium/src/v8/src/ic/ic-state.cc&l=44
>  https://msdn.microsoft.com/en-us/library/34h23df8(v=vs.100).aspx
Oh wait, it seems that code isn't using __declspec(selectany) after
all V8_HAS_DECLSPEC_SELECTANY isn't defined under Clang.
Maybe what happened is that we didn't use to emit the symbol, and now
when PR21164 is fixed we do, and get link errors.
I'll take a closer look at our code.
More information about the cfe-commits