Skip to content

Commit d6beb7d

Browse files
fsfodvgvassilev
authored andcommitted
Workaround 20 year old MSVC compiler bug for static fields of llvm::Registry
Fixes Tail': member of dll interface class may not be declared with dll interface https://developercommunity.visualstudio.com/t/c2487-in-dllexport-class-with-static-members/69878
1 parent beef0d9 commit d6beb7d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

llvm/include/llvm/Support/Registry.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,13 @@ namespace llvm {
5353
Registry() = delete;
5454

5555
friend class node;
56-
static node *Head, *Tail;
56+
// These must be must two separate declarations to workaround a 20 year
57+
// old MSVC bug with dllexport and multiple static fields in the same
58+
// declaration causing error C2487 "member of dll interface class may not
59+
// be declared with dll interface".
60+
// https://developercommunity.visualstudio.com/t/c2487-in-dllexport-class-with-static-members/69878
61+
static node *Head;
62+
static node *Tail;
5763

5864
public:
5965
/// Node in linked list of entries.

0 commit comments

Comments
 (0)