1 // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fsyntax-only -fms-extensions -verify %s
2 // RUN: %clang_cc1 -triple x86_64-pc-windows-msvc -fsyntax-only -fms-extensions -verify %s -DMSVC
3 
4 // Export const variable.
5 
6 #ifdef MSVC
7 // expected-error@+4 {{'j' must have external linkage when declared 'dllexport'}}
8 #else
9 // expected-warning@+2 {{__declspec attribute 'dllexport' is not supported}}
10 #endif
11 __declspec(dllexport) int const j; // expected-error {{default initialization of an object of const type 'const int'}}
12 
13 // With typedef
14 typedef const int CInt;
15 
16 #ifdef MSVC
17 // expected-error@+4 {{'j2' must have external linkage when declared 'dllexport'}}
18 #else
19 // expected-warning@+2 {{__declspec attribute 'dllexport' is not supported}}
20 #endif
21 __declspec(dllexport) CInt j2; //expected-error {{default initialization of an object of const type 'CInt'}}
22 
23 #ifndef MSVC
24 // expected-warning@+2 {{__declspec attribute 'dllexport' is not supported}}
25 #endif
26 __declspec(dllexport) CInt j3 = 3;
27