diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-06-29 20:59:39 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-06-29 20:59:39 +0000 |
commit | 8f5d4423ca126d66beddd0db69c384f6d07f1a93 (patch) | |
tree | 5835a0a7c5c6d546cae3a3f320d5ecd8f1f4ce39 /clang/test/CodeGenCXX/function-template-specialization.cpp | |
parent | 10de9e6602fcbe351aa20367c19a8cc39bb0c991 (diff) | |
download | bcm5719-llvm-8f5d4423ca126d66beddd0db69c384f6d07f1a93.tar.gz bcm5719-llvm-8f5d4423ca126d66beddd0db69c384f6d07f1a93.zip |
Keep track of function template specializations, to eliminate
redundant, implicit instantiations of function templates and provide a
place where we can hang function template specializations.
llvm-svn: 74454
Diffstat (limited to 'clang/test/CodeGenCXX/function-template-specialization.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/function-template-specialization.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/function-template-specialization.cpp b/clang/test/CodeGenCXX/function-template-specialization.cpp new file mode 100644 index 00000000000..685306f8bed --- /dev/null +++ b/clang/test/CodeGenCXX/function-template-specialization.cpp @@ -0,0 +1,21 @@ +// RUN: clang-cc -emit-llvm %s -o - +template<typename T, typename U> +T* next(T* ptr, const U& diff); + +template<typename T, typename U> +T* next(T* ptr, const U& diff) { + return ptr + diff; +} + +void test(int *iptr, float *fptr, int diff) { + iptr = next(iptr, diff); + fptr = next(fptr, diff); +} + +template<typename T, typename U> +T* next(T* ptr, const U& diff); + +void test2(int *iptr, double *dptr, int diff) { + iptr = next(iptr, diff); + dptr = next(dptr, diff); +}
\ No newline at end of file |