aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2015-01-29 11:09:56 -0500
committerJason Merrill <jason@gcc.gnu.org>2015-01-29 11:09:56 -0500
commite1ef8aa9395fab0c4a01b565b74f40937eef9ba5 (patch)
tree7e74147290505d09febf9fb06950da8031bac967
parent52d285303c8fb614b39a0c0366ef7decd4bea198 (diff)
downloadgcc-e1ef8aa9395fab0c4a01b565b74f40937eef9ba5.zip
gcc-e1ef8aa9395fab0c4a01b565b74f40937eef9ba5.tar.gz
gcc-e1ef8aa9395fab0c4a01b565b74f40937eef9ba5.tar.bz2
re PR c++/64521 (ICE with -frepo)
PR c++/64521 * repo.c (repo_emit_p): It's OK for a clone to be extern at this point. From-SVN: r220251
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/repo.c6
-rw-r--r--gcc/testsuite/g++.dg/template/repo11.C31
3 files changed, 42 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 743fda3..fb3e2dc 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2015-01-29 Jason Merrill <jason@redhat.com>
+
+ PR c++/64521
+ * repo.c (repo_emit_p): It's OK for a clone to be extern at this
+ point.
+
2015-01-27 Caroline Tice <cmtice@google.com>
Committing VTV Cywin/Ming patch for Patrick Wollgast
diff --git a/gcc/cp/repo.c b/gcc/cp/repo.c
index 604d667..f417e4b 100644
--- a/gcc/cp/repo.c
+++ b/gcc/cp/repo.c
@@ -302,7 +302,11 @@ repo_emit_p (tree decl)
int ret = 0;
gcc_assert (TREE_PUBLIC (decl));
gcc_assert (VAR_OR_FUNCTION_DECL_P (decl));
- gcc_assert (!DECL_REALLY_EXTERN (decl));
+ gcc_assert (!DECL_REALLY_EXTERN (decl)
+ /* A clone might not have its linkage flags updated yet
+ because we call import_export_decl before
+ maybe_clone_body. */
+ || DECL_ABSTRACT_ORIGIN (decl));
/* When not using the repository, emit everything. */
if (!flag_use_repository)
diff --git a/gcc/testsuite/g++.dg/template/repo11.C b/gcc/testsuite/g++.dg/template/repo11.C
new file mode 100644
index 0000000..5cabfd4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/repo11.C
@@ -0,0 +1,31 @@
+// PR c++/64521
+// { dg-options "-frepo -std=c++11" }
+// { dg-require-host-local "" }
+// { dg-skip-if "dkms are not final links" { vxworks_kernel } }
+// { dg-final cleanup-repo-files }
+
+template <typename H> struct J { J(H) {} };
+template <unsigned long, typename...> struct K;
+template <unsigned long I> struct K<I> {};
+template <unsigned long I, typename H, typename... T>
+struct K<I, H, T...> : K<I + 1, T...>, J<H> {
+ K(const H &p1, const T &... p2) : K<I + 1, T...>(p2...), J<H>(p1) {}
+};
+template <typename... E> struct C : K<0, E...> {
+ C(const E &... p1) : K<0, E...>(p1...) {}
+};
+template <typename> struct A {
+ A() = default;
+};
+struct M;
+template <typename> struct L {
+ struct B {
+ template <typename> static M *__test(...);
+ typedef A<int> _Del;
+ typedef decltype(__test<_Del>()) type;
+ };
+ C<typename B::type, A<M>> _M_t;
+ L(typename B::type) : _M_t(0, A<M>()) {}
+};
+struct M {};
+int main() { L<int>(new M); }