summaryrefslogtreecommitdiff
path: root/test/CodeGenCXX/mangle-exprs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGenCXX/mangle-exprs.cpp')
-rw-r--r--test/CodeGenCXX/mangle-exprs.cpp66
1 files changed, 66 insertions, 0 deletions
diff --git a/test/CodeGenCXX/mangle-exprs.cpp b/test/CodeGenCXX/mangle-exprs.cpp
index c5f72d83c7501..30da4fbbcdf94 100644
--- a/test/CodeGenCXX/mangle-exprs.cpp
+++ b/test/CodeGenCXX/mangle-exprs.cpp
@@ -1,5 +1,37 @@
// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
+namespace std {
+ typedef decltype(sizeof(int)) size_t;
+
+ // libc++'s implementation
+ template <class _E>
+ class initializer_list
+ {
+ const _E* __begin_;
+ size_t __size_;
+
+ initializer_list(const _E* __b, size_t __s)
+ : __begin_(__b),
+ __size_(__s)
+ {}
+
+ public:
+ typedef _E value_type;
+ typedef const _E& reference;
+ typedef const _E& const_reference;
+ typedef size_t size_type;
+
+ typedef const _E* iterator;
+ typedef const _E* const_iterator;
+
+ initializer_list() : __begin_(nullptr), __size_(0) {}
+
+ size_t size() const {return __size_;}
+ const _E* begin() const {return __begin_;}
+ const _E* end() const {return __begin_ + __size_;}
+ };
+}
+
template < bool condition, typename T = void >
struct enable_if { typedef T type; };
@@ -28,6 +60,10 @@ namespace Casts {
void auto_(decltype(new auto(T()))) {
}
+ template< typename T >
+ void scalar_(decltype(T(), int())) {
+ }
+
// FIXME: Test const_cast, reinterpret_cast, dynamic_cast, which are
// a bit harder to use in template arguments.
template <unsigned N> struct T {};
@@ -48,6 +84,9 @@ namespace Casts {
// CHECK: define weak_odr void @_ZN5Casts5auto_IiEEvDTnw_DapicvT__EEE(
template void auto_<int>(int*);
+
+ // CHECK: define weak_odr void @_ZN5Casts7scalar_IiEEvDTcmcvT__Ecvi_EE(
+ template void scalar_<int>(int);
}
namespace test1 {
@@ -125,3 +164,30 @@ namespace test3 {
a(x, &X::member, ip);
}
}
+
+namespace test4 {
+ struct X {
+ X(int);
+ };
+
+ template <typename T>
+ void tf1(decltype(new T(1)) p)
+ {}
+
+ template <typename T>
+ void tf2(decltype(new T({1})) p)
+ {}
+
+ template <typename T>
+ void tf3(decltype(new T{1}) p)
+ {}
+
+ // CHECK: void @_ZN5test43tf1INS_1XEEEvDTnw_T_piLi1EEE
+ template void tf1<X>(X*);
+
+ // CHECK: void @_ZN5test43tf2INS_1XEEEvDTnw_T_piilLi1EEEE
+ template void tf2<X>(X*);
+
+ // CHECK: void @_ZN5test43tf3INS_1XEEEvDTnw_T_ilLi1EEE
+ template void tf3<X>(X*);
+}