Template static data members can have weak_odr linkage, not just
weak linkage. Also, fix a problem where global weak variables
with non-trivial initializers were getting guard variables, or at
least were checking for them and then crashing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129342 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGenCXX/global-init.cpp b/test/CodeGenCXX/global-init.cpp
index 53cfe05..f9eeb59 100644
--- a/test/CodeGenCXX/global-init.cpp
+++ b/test/CodeGenCXX/global-init.cpp
@@ -97,6 +97,16 @@
};
}
+namespace test6 {
+ struct A {
+ A();
+ };
+ extern int foo();
+
+ // This needs an initialization function but not guard variables.
+ __attribute__((weak)) int x = foo();
+}
+
// At the end of the file, we check that y is initialized before z.
// CHECK: define internal void @_GLOBAL__I_a() section "__TEXT,__StaticInit,regular,pure_instructions" {