Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/dmd/mtype.d
Original file line number Diff line number Diff line change
Expand Up @@ -5506,7 +5506,9 @@ extern (C++) final class TypeStruct : Type
// Probably should cache this information in sym rather than recompute
StructDeclaration s = sym;

sym.size(Loc.initial); // give error for forward references
if (sym.members && !sym.determineFields() && sym.type != Type.terror)
error(sym.loc, "no size because of forward references");

foreach (VarDeclaration v; s.fields)
{
if (v.storage_class & STC.ref_ || v.hasPointers())
Expand Down
14 changes: 14 additions & 0 deletions test/compilable/test19145.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// https://issues.dlang.org/show_bug.cgi?id=19415

struct S
{
int x;
S foo() return { return S(x); }
this(this) @disable;
}

S bar()
{
S s;
return s; // Error: struct `S` is not copyable because it is annotated with @disable
}