d: Fix internal compiler error: in make_import, at d/imports.cc:48 [PR113125]

The cause of the ICE was that TYPE_DECLs were only being generated for
structs with members, not opaque structs.

	PR d/113125

gcc/d/ChangeLog:

	* types.cc (TypeVisitor::visit (TypeStruct *)): Generate TYPE_DECL and
	apply UDAs to opaque struct declarations.

gcc/testsuite/ChangeLog:

	* gdc.dg/imports/pr113125.d: New test.
	* gdc.dg/pr113125.d: New test.
This commit is contained in:
Iain Buclaw 2024-02-12 16:59:12 +01:00
parent 2dde675ff4
commit b0efb1c357
3 changed files with 11 additions and 0 deletions

View File

@ -1230,6 +1230,11 @@ public:
apply_user_attributes (t->sym, t->ctype);
finish_aggregate_type (structsize, alignsize, t->ctype);
}
else
{
build_type_decl (t->ctype, t->sym);
apply_user_attributes (t->sym, t->ctype);
}
/* For structs with a user defined postblit, copy constructor, or a
destructor, also set TREE_ADDRESSABLE on the type and all variants.

View File

@ -0,0 +1,2 @@
module imports.pr113125;
struct S113125;

View File

@ -0,0 +1,4 @@
// { dg-do compile }
// { dg-options "-I $srcdir/gdc.dg" }
module pr113125;
import imports.pr113125: S113125;