[Reland][Runtimes] Merge 'compile_commands.json' files from runtimes build (#116303)
[llvm-project.git] / clang / test / Sema / dllexport-2.cpp
blob41d96cc4e6809871db79a9105b6e73d2b0ef4fbf
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
4 // Export const variable.
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'}}
13 // With typedef
14 typedef const int CInt;
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'}}
23 #ifndef MSVC
24 // expected-warning@+2 {{__declspec attribute 'dllexport' is not supported}}
25 #endif
26 __declspec(dllexport) CInt j3 = 3;