pcc created this revision.
pcc added a reviewer: majnemer.
pcc added a subscriber: cfe-commits.

>From the linker's perspective, an available_externally global is equivalent to
an external declaration, therefore it should not have a comdat. The presence
of a comdat can cause problems later on during LTO if a comdat containing
an available_externally global is chosen over a comdat containing a real
definition of the global.

Depends on http://reviews.llvm.org/D10941

http://reviews.llvm.org/D10942

Files:
  test/CodeGenCXX/microsoft-abi-static-initializers-available-externally.cpp

Index: 
test/CodeGenCXX/microsoft-abi-static-initializers-available-externally.cpp
===================================================================
--- /dev/null
+++ test/CodeGenCXX/microsoft-abi-static-initializers-available-externally.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc18.0.0 -std=c++11 -emit-llvm 
-O %s -o - | FileCheck %s
+
+// CHECK: = available_externally
+// CHECK-NOT: comdat
+
+template <typename>
+class A {
+public:
+  static void f() { static int a = *new int; }
+};
+
+extern template class A<int>;
+void f() { A<int>::f(); }


Index: test/CodeGenCXX/microsoft-abi-static-initializers-available-externally.cpp
===================================================================
--- /dev/null
+++ test/CodeGenCXX/microsoft-abi-static-initializers-available-externally.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc18.0.0 -std=c++11 -emit-llvm -O %s -o - | FileCheck %s
+
+// CHECK: = available_externally
+// CHECK-NOT: comdat
+
+template <typename>
+class A {
+public:
+  static void f() { static int a = *new int; }
+};
+
+extern template class A<int>;
+void f() { A<int>::f(); }
_______________________________________________
cfe-commits mailing list
cfe-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to