xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/ms-integer-static-data-members-exported.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -emit-llvm -triple=i386-pc-win32 -fms-compatibility %s -o - | FileCheck %s
2*0a6a1f1dSLionel Sambuc 
3*0a6a1f1dSLionel Sambuc enum Enum { zero, one, two };
4*0a6a1f1dSLionel Sambuc 
5*0a6a1f1dSLionel Sambuc struct __declspec(dllexport) S {
6*0a6a1f1dSLionel Sambuc   // In MS compatibility mode, this counts as a definition.
7*0a6a1f1dSLionel Sambuc   // Since it is exported, it must be emitted even if it's unreferenced.
8*0a6a1f1dSLionel Sambuc   static const short x = 42;
9*0a6a1f1dSLionel Sambuc 
10*0a6a1f1dSLionel Sambuc   // This works for enums too.
11*0a6a1f1dSLionel Sambuc   static const Enum y = two;
12*0a6a1f1dSLionel Sambuc 
13*0a6a1f1dSLionel Sambuc   struct NonExported {
14*0a6a1f1dSLionel Sambuc     // dllexport is not inherited by this nested class.
15*0a6a1f1dSLionel Sambuc     // Since z is not referenced, it should not be emitted.
16*0a6a1f1dSLionel Sambuc     static const int z = 42;
17*0a6a1f1dSLionel Sambuc   };
18*0a6a1f1dSLionel Sambuc };
19*0a6a1f1dSLionel Sambuc 
20*0a6a1f1dSLionel Sambuc // CHECK: @"\01?x@S@@2FB" = weak_odr dllexport constant i16 42, align 2
21*0a6a1f1dSLionel Sambuc // CHECK: @"\01?y@S@@2W4Enum@@B" = weak_odr dllexport constant i32 2, align 4
22*0a6a1f1dSLionel Sambuc // CHECK-NOT: NonExported
23