r237787 - [MSVC] Handle out-of-line definition of static data member correctly (fix for http://llvm.org/PR21164), by Alexey Frolov

Hans Wennborg hans at chromium.org
Wed May 20 09:26:13 PDT 2015


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
> Log:
> [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 [0].

It seems [1] is both initialized inside the class and defined outside
the class, but with __declspec(selectany) to appease MSVC as suggested
by [2]. 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?

 [0]. http://build.chromium.org/p/chromium.fyi/builders/CrWinClang%28dbg%29/builds/441/steps/compile/logs/stdio
 [1] https://code.google.com/p/chromium/codesearch#chromium/src/v8/src/ic/ic-state.cc&l=44
 [2] https://msdn.microsoft.com/en-us/library/34h23df8(v=vs.100).aspx



More information about the cfe-commits mailing list