summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/explicit-instantiation.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-09-04 22:48:11 +0000
committerDouglas Gregor <dgregor@apple.com>2009-09-04 22:48:11 +0000
commit34ec2ef159c0d712ee66364228bd16dbe7f5e390 (patch)
tree88a51c59692b5c83131f813645f2a995ed4933c9 /clang/test/CodeGenCXX/explicit-instantiation.cpp
parent21d15aa591e142396aad3b79569f0aa8ce6f66e3 (diff)
downloadbcm5719-llvm-34ec2ef159c0d712ee66364228bd16dbe7f5e390.tar.gz
bcm5719-llvm-34ec2ef159c0d712ee66364228bd16dbe7f5e390.zip
Improve the AST representation and semantic analysis for extern
templates. We now distinguish between an explicit instantiation declaration and an explicit instantiation definition, and know not to instantiate explicit instantiation declarations. Unfortunately, there is some remaining confusion w.r.t. instantiation of out-of-line member function definitions that causes trouble here. llvm-svn: 81053
Diffstat (limited to 'clang/test/CodeGenCXX/explicit-instantiation.cpp')
-rw-r--r--clang/test/CodeGenCXX/explicit-instantiation.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/clang/test/CodeGenCXX/explicit-instantiation.cpp b/clang/test/CodeGenCXX/explicit-instantiation.cpp
index 38966aad2de..33cbf7f872e 100644
--- a/clang/test/CodeGenCXX/explicit-instantiation.cpp
+++ b/clang/test/CodeGenCXX/explicit-instantiation.cpp
@@ -1,11 +1,17 @@
// RUN: clang-cc -emit-llvm -femit-all-decls -o %t %s &&
// RUN: grep "_ZNK4plusIillEclERKiRKl" %t | count 1
+// FIXME: We should not need the -femit-all-decls, because operator() should
+// be emitted as an external symbol rather than with linkonce_odr linkage.
+// This is a Sema problem.
template<typename T, typename U, typename Result>
struct plus {
- Result operator()(const T& t, const U& u) const {
- return t + u;
- }
+ Result operator()(const T& t, const U& u) const;
};
+template<typename T, typename U, typename Result>
+Result plus<T, U, Result>::operator()(const T& t, const U& u) const {
+ return t + u;
+}
+
template struct plus<int, long, long>;
OpenPOWER on IntegriCloud