Issue 1564 - Forward reference error for enum in circular import
Summary: Forward reference error for enum in circular import
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks: 340
  Show dependency treegraph
 
Reported: 2007-10-09 23:33 UTC by tomqyp
Modified: 2014-02-24 15:33 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description tomqyp 2007-10-09 23:33:28 UTC
//file1 testA.d
module testa;
import testb;

enum TestEnum {
	A,
}

class CCC{
	int a;
}

struct SSS{
	int a;
}

------------------------------

//file2 testB.d
module testb;
import testa;

TestEnum te;
CCC ccc;
SSS sss;




Compile the testA.d, class and struct are ok, but to enum,dmd say "enum TestEnum is forward referenced"

This question is divided into these kinds of situations specifically:
1.Compiling two files of above alone separately,DMD and GDC all fail when compiling testA.d.
   dmd testA.d -c
   
2.DMD and GDC all fail to Compile two files of above in once,and testA.d in before testB.d in back.
   dmd testA.d testB.d -c
   
3.DMD is OK GDC is fail when testB.d in before testA.d in back.
   dmd testB.d testA.d -c
Comment 1 Stewart Gordon 2007-10-10 07:51:58 UTC
Not quite the error I get (DMD 1.022):

testA.d(5): Error: enum TestEnum is forward referenced

Please report compiler messages in full.  And please remember to assign keywords to bug reports.  To everybody reading this: Please look through issues you've reported and check for missing keywords.
Comment 2 Matti Niemenmaa 2007-10-10 11:15:42 UTC
Is this a duplicate of Issue 1160?
Comment 3 Stewart Gordon 2007-11-13 17:13:39 UTC
No.  Issue 1160 actually is a forward reference.  This isn't - the phrase "forward referenced" just happens to be in the error message.
Comment 4 Walter Bright 2009-12-31 11:10:55 UTC
Fixed dmd 1.054 and 2.038