A type in an anonymous namespace can never be merged with one from
another translation unit, so a member of such a type is always its own
prevailing decl.
* lto-symtab.c (lto_symtab_prevailing_virtual_decl): Return early
for a type in an anonymous namespace.
From-SVN: r269283
+2019-02-28 Jason Merrill <jason@redhat.com>
+
+ PR c++/88049 - ICE with undefined destructor and anon namespace.
+ * lto-symtab.c (lto_symtab_prevailing_virtual_decl): Return early
+ for a type in an anonymous namespace.
+
2019-01-09 Sandra Loosemore <sandra@codesourcery.com>
PR other/16615
{
if (DECL_ABSTRACT_P (decl))
return decl;
- gcc_checking_assert (!type_in_anonymous_namespace_p (DECL_CONTEXT (decl))
- && DECL_ASSEMBLER_NAME_SET_P (decl));
+
+ if (type_in_anonymous_namespace_p (DECL_CONTEXT (decl)))
+ /* There can't be any other declarations. */
+ return decl;
+
+ gcc_checking_assert (DECL_ASSEMBLER_NAME_SET_P (decl));
symtab_node *n = symtab_node::get_for_asmname
(DECL_ASSEMBLER_NAME (decl));
--- /dev/null
+// PR c++/88049
+// { dg-lto-do link }
+// { dg-lto-options {{ -flto -O2 -w }} }
+// { dg-extra-ld-options -r }
+
+template <typename> class a;
+class b {};
+template <typename e> a<e> d(char);
+template <typename> class a : public b {
+public:
+ virtual ~a();
+};
+namespace {
+ class f;
+ b c = d<f>(int());
+} // namespace