summaryrefslogtreecommitdiff
path: root/test/CodeGenCXX/mangle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGenCXX/mangle.cpp')
-rw-r--r--test/CodeGenCXX/mangle.cpp57
1 files changed, 48 insertions, 9 deletions
diff --git a/test/CodeGenCXX/mangle.cpp b/test/CodeGenCXX/mangle.cpp
index e18ca03d1be2..8dee41beb482 100644
--- a/test/CodeGenCXX/mangle.cpp
+++ b/test/CodeGenCXX/mangle.cpp
@@ -250,26 +250,26 @@ void f() { __fill_a<int>(); }
namespace Expressions {
// Unary operators.
-// CHECK: define void @_ZN11Expressions2f1ILi1EEEvPAplngT_Li2E_i
+// CHECK: define weak_odr void @_ZN11Expressions2f1ILi1EEEvPAplngT_Li2E_i
template <int i> void f1(int (*)[(-i) + 2]) { };
template void f1<1>(int (*)[1]);
-// CHECK: define void @_ZN11Expressions2f2ILi1EEEvPApsT__i
+// CHECK: define weak_odr void @_ZN11Expressions2f2ILi1EEEvPApsT__i
template <int i> void f2(int (*)[+i]) { };
template void f2<1>(int (*)[1]);
// Binary operators.
-// CHECK: define void @_ZN11Expressions2f3ILi1EEEvPAplT_T__i
+// CHECK: define weak_odr void @_ZN11Expressions2f3ILi1EEEvPAplT_T__i
template <int i> void f3(int (*)[i+i]) { };
template void f3<1>(int (*)[2]);
-// CHECK: define void @_ZN11Expressions2f4ILi1EEEvPAplplLi2ET_T__i
+// CHECK: define weak_odr void @_ZN11Expressions2f4ILi1EEEvPAplplLi2ET_T__i
template <int i> void f4(int (*)[2 + i+i]) { };
template void f4<1>(int (*)[4]);
// The ternary operator.
-// CHECK: define void @_ZN11Expressions2f4ILb1EEEvPAquT_Li1ELi2E_i
+// CHECK: define weak_odr void @_ZN11Expressions2f4ILb1EEEvPAquT_Li1ELi2E_i
template <bool b> void f4(int (*)[b ? 1 : 2]) { };
template void f4<true>(int (*)[1]);
}
@@ -305,7 +305,7 @@ template<typename T, typename = Policy<P, true> > class Alloc
T *allocate(int, const void*) { return 0; }
};
-// CHECK: define i8* @_ZN6PR58615AllocIcNS_6PolicyINS_1PELb1EEEE8allocateEiPKv
+// CHECK: define weak_odr i8* @_ZN6PR58615AllocIcNS_6PolicyINS_1PELb1EEEE8allocateEiPKv
template class Alloc<char>;
}
@@ -369,7 +369,7 @@ namespace test0 {
namespace test1 {
template<typename T> struct X { };
template<template<class> class Y, typename T> void f(Y<T>) { }
- // CHECK: define void @_ZN5test11fINS_1XEiEEvT_IT0_E
+ // CHECK: define weak_odr void @_ZN5test11fINS_1XEiEEvT_IT0_E
template void f(X<int>);
}
@@ -399,10 +399,10 @@ namespace test3 {
//template <class T> decltype(((T*) 0)->Path1::ab) get_ab_1(T &ref) { return ref.Path1::ab; }
//template <class T> decltype(((T*) 0)->Path2::ab) get_ab_2(T &ref) { return ref.Path2::ab; }
- // define linkonce_odr float @_ZN5test37get_p_1INS_7DerivedEEEDtptcvPT_Li0E5Path11pERS2_(
+ // define weak_odr float @_ZN5test37get_p_1INS_7DerivedEEEDtptcvPT_Li0E5Path11pERS2_(
template <class T> decltype(((T*) 0)->Path1::p) get_p_1(T &ref) { return ref.Path1::p; }
- // define linkonce_odr double @_ZN5test37get_p_1INS_7DerivedEEEDtptcvPT_Li0E5Path21pERS2_(
+ // define weak_odr double @_ZN5test37get_p_1INS_7DerivedEEEDtptcvPT_Li0E5Path21pERS2_(
template <class T> decltype(((T*) 0)->Path2::p) get_p_2(T &ref) { return ref.Path2::p; }
Derived obj;
@@ -414,3 +414,42 @@ namespace test3 {
get_p_2(obj);
}
}
+
+// CHECK: define void @_ZN5test41gEPNS_3zedIXadL_ZNS_3foo3barEEEEE
+namespace test4 {
+ struct foo { int bar; };
+ template <int (foo::*)>
+ struct zed {};
+ void g(zed<&foo::bar>*)
+ {}
+}
+// CHECK: define void @_ZN5test51gEPNS_3zedIXadL_ZNS_3foo3barEEEEE
+namespace test5 {
+ struct foo { static int bar; };
+ template <int *>
+ struct zed {};
+ void g(zed<&foo::bar>*)
+ {}
+}
+// CHECK: define void @_ZN5test61gEPNS_3zedIXadL_ZNS_3foo3barEvEEEE
+namespace test6 {
+ struct foo { int bar(); };
+ template <int (foo::*)()>
+ struct zed {};
+ void g(zed<&foo::bar>*)
+ {}
+}
+// CHECK: define void @_ZN5test71gEPNS_3zedIXadL_ZNS_3foo3barEvEEEE
+namespace test7 {
+ struct foo { static int bar(); };
+ template <int (*f)()>
+ struct zed {};
+ void g(zed<&foo::bar>*)
+ {}
+}
+// CHECK: define weak_odr void @_ZN5test81AILZNS_1B5valueEEE3incEv
+namespace test8 {
+ template <int &counter> class A { void inc() { counter++; } };
+ class B { static int value; };
+ template class A<B::value>;
+}