2386 – Array of forward referenced struct doesn't compile

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2386 - Array of forward referenced struct doesn't compile
Summary: Array of forward referenced struct doesn't compile
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: patch, rejects-valid
Depends on:
Blocks: 340 2654
Show dependency tree / graph
Reported: 2008年10月02日 09:49 UTC by anonymous4
Modified: 2015年06月09日 01:20 UTC (History)
3 users (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description anonymous4 2008年10月02日 09:49:14 UTC
struct BB
{
 Item[1] aa; //struct tmp.Item no size yet for forward reference
}
struct CC
{
 Item aa; //ok
}
struct Item
{
 byte data;
}
Comment 1 Rainer Schuetze 2010年03月27日 06:17:13 UTC
Here's a patch that simply invokes the semantics of the forward referenced struct.
Index: struct.c
===================================================================
--- struct.c	(revision 421)
+++ struct.c	(working copy)
@@ -115,6 +115,8 @@
 //printf("AggregateDeclaration::size() = %d\n", structsize);
 if (!members)
 	error(loc, "unknown size");
+ if (sizeok != 1 && scope)
+	semantic(NULL);
 if (sizeok != 1)
 {	error(loc, "no size yet for forward reference");
 	//*(char*)0=0;
This patch also fixes #2654
Comment 2 Walter Bright 2010年05月10日 13:39:09 UTC
changeset 429
Comment 3 bearophile_hugs 2010年05月15日 17:53:20 UTC
This is fixed in v2.046 and v1.061.


AltStyle によって変換されたページ (->オリジナル) /