explicit-instantiation.cpp revision d0e3daf2b980b505e535d35b432c938c6d0208ef
1// RUN: clang-cc -emit-llvm -femit-all-decls -o %t %s &&
2// RUN: grep "_ZNK4plusIillEclERKiRKl" %t | count 1
3
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.
7template<typename T, typename U, typename Result>
8struct plus {
9  Result operator()(const T& t, const U& u) const;
10};
11
12template<typename T, typename U, typename Result>
13Result plus<T, U, Result>::operator()(const T& t, const U& u) const {
14  return t + u;
15}
16
17template struct plus<int, long, long>;
18