From e1ef8aa9395fab0c4a01b565b74f40937eef9ba5 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 29 Jan 2015 11:09:56 -0500 Subject: [PATCH] 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 --- gcc/cp/ChangeLog | 6 +++++ gcc/cp/repo.c | 6 ++++- gcc/testsuite/g++.dg/template/repo11.C | 31 ++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/template/repo11.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 743fda3704d..fb3e2dc79e4 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2015-01-29 Jason Merrill + + 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 Committing VTV Cywin/Ming patch for Patrick Wollgast diff --git a/gcc/cp/repo.c b/gcc/cp/repo.c index 604d66728de..f417e4b56f1 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 00000000000..5cabfd452ed --- /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 struct J { J(H) {} }; +template struct K; +template struct K {}; +template +struct K : K, J { + K(const H &p1, const T &... p2) : K(p2...), J(p1) {} +}; +template struct C : K<0, E...> { + C(const E &... p1) : K<0, E...>(p1...) {} +}; +template struct A { + A() = default; +}; +struct M; +template struct L { + struct B { + template static M *__test(...); + typedef A _Del; + typedef decltype(__test<_Del>()) type; + }; + C> _M_t; + L(typename B::type) : _M_t(0, A()) {} +}; +struct M {}; +int main() { L(new M); } -- 2.30.2