Douglas Gregor | aba43bb | 2009-05-26 20:50:29 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -emit-llvm -femit-all-decls -o %t %s && |
| 2 | // RUN: grep "_ZNK4plusIillEclERKiRKl" %t | count 1 |
| 3 | |
Douglas Gregor | d0e3daf | 2009-09-04 22:48:11 +0000 | [diff] [blame^] | 4 | // FIXME: We should not need the -femit-all-decls, because operator() should |
| 5 | // be emitted as an external symbol rather than with linkonce_odr linkage. |
| 6 | // This is a Sema problem. |
Douglas Gregor | aba43bb | 2009-05-26 20:50:29 +0000 | [diff] [blame] | 7 | template<typename T, typename U, typename Result> |
| 8 | struct plus { |
Douglas Gregor | d0e3daf | 2009-09-04 22:48:11 +0000 | [diff] [blame^] | 9 | Result operator()(const T& t, const U& u) const; |
Douglas Gregor | aba43bb | 2009-05-26 20:50:29 +0000 | [diff] [blame] | 10 | }; |
| 11 | |
Douglas Gregor | d0e3daf | 2009-09-04 22:48:11 +0000 | [diff] [blame^] | 12 | template<typename T, typename U, typename Result> |
| 13 | Result plus<T, U, Result>::operator()(const T& t, const U& u) const { |
| 14 | return t + u; |
| 15 | } |
| 16 | |
Douglas Gregor | aba43bb | 2009-05-26 20:50:29 +0000 | [diff] [blame] | 17 | template struct plus<int, long, long>; |