summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/explicit-instantiation.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2017-11-16 23:54:56 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2017-11-16 23:54:56 +0000
commite2467b7aed5d90db90108e8486cfc5e6dbae2b41 (patch)
tree7917e383903f16ba5990a0b27ed29861218f269d /clang/test/CodeGenCXX/explicit-instantiation.cpp
parent39bcd4ed3e5e824f363303077c98f54be61c3add (diff)
downloadbcm5719-llvm-e2467b7aed5d90db90108e8486cfc5e6dbae2b41.tar.gz
bcm5719-llvm-e2467b7aed5d90db90108e8486cfc5e6dbae2b41.zip
PR22763: if a defaulted (non-user-provided) special member function is
explicitly instantiated, still emit it with each use. We don't emit a definition of the member with an explicit instantiation definition (and indeed it appears that we're not allowed to, since an explicit instantiation definition does not constitute an odr-use and only odr-use permits definition for defaulted special members). So we still need to emit a weak definition with each use. This also makes defaulted-in-class declarations behave more like implicitly-declared special members, which matches their design intent. And it matches the way this problem was solved in GCC. llvm-svn: 318474
Diffstat (limited to 'clang/test/CodeGenCXX/explicit-instantiation.cpp')
-rw-r--r--clang/test/CodeGenCXX/explicit-instantiation.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/explicit-instantiation.cpp b/clang/test/CodeGenCXX/explicit-instantiation.cpp
index 85857fb6fb8..ad20abde8f1 100644
--- a/clang/test/CodeGenCXX/explicit-instantiation.cpp
+++ b/clang/test/CodeGenCXX/explicit-instantiation.cpp
@@ -170,3 +170,22 @@ void use() {
f<int>();
}
}
+
+namespace DefaultedMembers {
+ struct B { B(); B(const B&); ~B(); };
+ template<typename T> struct A : B {
+ A() = default;
+ ~A() = default;
+ };
+ extern template struct A<int>;
+
+ // CHECK-LABEL: define {{.*}} @_ZN16DefaultedMembers1AIiEC2Ev
+ // CHECK-LABEL: define {{.*}} @_ZN16DefaultedMembers1AIiED2Ev
+ A<int> ai;
+
+ // CHECK-LABEL: define {{.*}} @_ZN16DefaultedMembers1AIiEC2ERKS1_
+ A<int> ai2(ai);
+
+ // CHECK-NOT: @_ZN16DefaultedMembers1AIcE
+ template struct A<char>;
+}
OpenPOWER on IntegriCloud