Clang Project

clang_source_code/test/CodeGenCXX/microsoft-compatibility.cpp
1// RUN: %clang_cc1 %s -triple i686-pc-win32 -std=c++11 -fms-compatibility -emit-llvm -o - | FileCheck %s
2
3template <typename>
4struct S {
5  static const int x[];
6};
7
8template <>
9const int S<char>::x[] = {1};
10
11// CHECK-LABEL: @"?x@?$S@D@@2QBHB" = weak_odr dso_local constant [1 x i32] [i32 1], comdat
12
13template<class T>
14void destroy(T *p) {
15  p->~T();
16}
17
18extern "C" void f() {
19  int a;
20  destroy((void*)&a);
21}
22
23// CHECK-LABEL: define dso_local void @f()
24// CHECK: call void @"??$destroy@X@@YAXPAX@Z"
25// CHECK: ret void
26
27// CHECK-LABEL: define linkonce_odr dso_local void @"??$destroy@X@@YAXPAX@Z"(i8* %p)
28//    The pseudo-dtor expr should not generate calls to anything.
29// CHECK-NOT: call
30// CHECK-NOT: invoke
31// CHECK: ret void
32