summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/dllimport.c
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Sema/dllimport.c')
-rw-r--r--clang/test/Sema/dllimport.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/Sema/dllimport.c b/clang/test/Sema/dllimport.c
index f4d26fb8c87..2702453b61c 100644
--- a/clang/test/Sema/dllimport.c
+++ b/clang/test/Sema/dllimport.c
@@ -25,6 +25,9 @@ __declspec(dllimport) int GlobalDecl;
int **__attribute__((dllimport))* GlobalDeclChunkAttr;
int GlobalDeclAttr __attribute__((dllimport));
+// Address of variables can't be used for initialization in C language modes.
+int *VarForInit = &GlobalDecl; // expected-error{{initializer element is not a compile-time constant}}
+
// Not allowed on definitions.
__declspec(dllimport) extern int ExternGlobalInit = 1; // expected-error{{definition of dllimport data}}
__declspec(dllimport) int GlobalInit1 = 1; // expected-error{{definition of dllimport data}}
@@ -96,6 +99,11 @@ __declspec(dllimport) void decl1B();
void __attribute__((dllimport)) decl2A();
void __declspec(dllimport) decl2B();
+// Address of functions can be used for initialization in C language modes.
+// However, the address of the thunk wrapping the function is used instead of
+// the address in the import address table.
+void (*FunForInit)() = &decl2A;
+
// Not allowed on function definitions.
__declspec(dllimport) void def() {} // expected-error{{dllimport cannot be applied to non-inline function definition}}
OpenPOWER on IntegriCloud