d: Fix ICE force_type_die, at dwarf2out.c using nested types
authorIain Buclaw <ibuclaw@gdcproject.org>
Wed, 20 Mar 2019 23:52:48 +0000 (23:52 +0000)
committerIain Buclaw <ibuclaw@gcc.gnu.org>
Wed, 20 Mar 2019 23:52:48 +0000 (23:52 +0000)
commit9dddefefdf407376ed3a0bba09a14f65b194898d
tree1c5d4ec04a8021ff8e31befda84fa58201e0fb9b
parent5d2df818b7752021425581455aca08f3fd0902b7
d: Fix ICE force_type_die, at dwarf2out.c using nested types

In functions whose return type is instantiated from a nested template,
make sure that all members of the instance are emitted before finishing
the outer function, otherwise they will be removed during the
prune_unused_types pass.

gcc/d/ChangeLog:

2019-03-21  Iain Buclaw  <ibuclaw@gdcproject.org>

PR d/89017
* d-codegen.cc (d_decl_context): Skip over template instances when
finding the context.
* decl.cc (DeclVisitor::visit(TemplateDeclaration)): New override.
(build_type_decl): Include parameters in name of template types.

gcc/testsuite/ChangeLog:

2019-03-21  Iain Buclaw  <ibuclaw@gdcproject.org>

PR d/89017
* gdc.dg/pr89017.d: New test.

From-SVN: r269828
gcc/d/ChangeLog
gcc/d/d-codegen.cc
gcc/d/decl.cc
gcc/testsuite/ChangeLog
gcc/testsuite/gdc.dg/pr89017.d [new file with mode: 0644]