aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2008-11-19 14:27:29 -0500
committerJason Merrill <jason@gcc.gnu.org>2008-11-19 14:27:29 -0500
commitda3933ba836ad0821dfb7522fc9d6b9099969299 (patch)
tree91794fcf21c8549f5680c2011450492a3f72823e /gcc
parent2ad646bdcafe10bc1da16edca1e5961925e10417 (diff)
downloadgcc-da3933ba836ad0821dfb7522fc9d6b9099969299.zip
gcc-da3933ba836ad0821dfb7522fc9d6b9099969299.tar.gz
gcc-da3933ba836ad0821dfb7522fc9d6b9099969299.tar.bz2
re PR c++/37256 (extern template / explicit instantiation broken in 4.4.0-pre)
PR c++/37256 * pt.c (instantiate_decl): Don't require a definition of a template that is explicitly instantiated 'extern'. From-SVN: r142014
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c3
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/extern_template-3.C16
4 files changed, 29 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 4353263..8ce3cfe 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2008-11-19 Jason Merrill <jason@redhat.com>
+
+ PR c++/37256
+ * pt.c (instantiate_decl): Don't require a definition of
+ a template that is explicitly instantiated 'extern'.
+
2008-11-18 Jason Merrill <jason@redhat.com>
Jakub Jelinek <jakub@redhat.com>
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 13a2361..2b938c3 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -15226,7 +15226,8 @@ instantiate_decl (tree d, int defer_ok,
input_location = saved_loc;
if (at_eof && !pattern_defined
- && DECL_EXPLICIT_INSTANTIATION (d))
+ && DECL_EXPLICIT_INSTANTIATION (d)
+ && DECL_NOT_REALLY_EXTERN (d))
/* [temp.explicit]
The definition of a non-exported function template, a
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 4c2dd00..53a99de 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2008-11-19 Jason Merrill <jason@redhat.com>
+
+ PR c++/37256
+ * g++.dg/cpp0x/extern_template-3.C: New test.
+
2008-11-19 Maxim Kuvyrkov <maxim@codesourcery.com>
* gcc.target/m68k/xgot-1.c (dg-options): Add -O2.
diff --git a/gcc/testsuite/g++.dg/cpp0x/extern_template-3.C b/gcc/testsuite/g++.dg/cpp0x/extern_template-3.C
new file mode 100644
index 0000000..1b7ad0e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/extern_template-3.C
@@ -0,0 +1,16 @@
+// PR c++/37256
+// { dg-options "-O" }
+
+template <typename T_>
+struct B
+{
+ T_ f();
+};
+
+extern template class B<int>;
+
+void f()
+{
+ B<int> t;
+ t.f();
+}