diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-01-29 16:37:09 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-01-29 16:37:09 +0000 |
commit | 46287c7922b1c715b6ade87478e91409b19f0247 (patch) | |
tree | f04bb0b59c1fb5cd7b3c148563c2baa64c8253dd /test/CodeGenCXX/mangle-exprs.cpp | |
parent | ddc6b664e4caa86bcccbc2ddfe6ad0d4768372bc (diff) |
Name mangling for cast expressions, from Matthias Schiffer! Fixes PR5876.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94811 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/mangle-exprs.cpp')
-rw-r--r-- | test/CodeGenCXX/mangle-exprs.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/test/CodeGenCXX/mangle-exprs.cpp b/test/CodeGenCXX/mangle-exprs.cpp new file mode 100644 index 0000000000..cdad39852c --- /dev/null +++ b/test/CodeGenCXX/mangle-exprs.cpp @@ -0,0 +1,44 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s + +template < bool condition, typename T = void > +struct enable_if { typedef T type; }; + +template< typename T > +struct enable_if< false, T > {}; + +// PR5876 +namespace Casts { + template< unsigned O > + void implicit(typename enable_if< O <= 4 >::type* = 0) { + } + + template< unsigned O > + void cstyle(typename enable_if< O <= (unsigned)4 >::type* = 0) { + } + + template< unsigned O > + void functional(typename enable_if< O <= unsigned(4) >::type* = 0) { + } + + template< unsigned O > + void static_(typename enable_if< O <= static_cast<unsigned>(4) >::type* = 0) { + } + + // FIXME: Test const_cast, reinterpret_cast, dynamic_cast, which are + // a bit harder to use in template arguments. + template <unsigned N> struct T {}; + + template <int N> T<N> f() { return T<N>(); } + + // CHECK: define void @_ZN5Casts8implicitILj4EEEvPN9enable_ifIXleT_Li4EEvE4typeE + template void implicit<4>(void*); + // CHECK: define void @_ZN5Casts6cstyleILj4EEEvPN9enable_ifIXleT_cvjLi4EEvE4typeE + template void cstyle<4>(void*); + // CHECK: define void @_ZN5Casts10functionalILj4EEEvPN9enable_ifIXleT_cvjLi4EEvE4typeE + template void functional<4>(void*); + // CHECK: define void @_ZN5Casts7static_ILj4EEEvPN9enable_ifIXleT_cvjLi4EEvE4typeE + template void static_<4>(void*); + + // CHECK: define i64 @_ZN5Casts1fILi6EEENS_1TIXT_EEEv + template T<6> f<6>(); +} |