D - Bug: "class B forward reference of base class A"
- Andy Friesen (17/17) Jan 19 2004 Maybe this has been posted before, but I don't recall anybody managing
- Ant (49/73) Jan 19 2004 I was going to suggest:
- Ant (5/5) Jan 19 2004 On Mon, 19 Jan 2004 22:08:38 -0500, Ant wrote:
- Ant (10/17) Jan 19 2004 OK I went back to that second test.
- Lars Ivar Igesund (5/31) Jan 20 2004 I also reported on this with minimal examples some time ago.
Maybe this has been posted before, but I don't recall anybody managing to isolate this into a handful of lines of code, so I may as well post it now. (apologies if it has already been posted) a.d: import b; class A { B[] b; } b.d: import a; class B : A { } D:\temp\dtest>dmd a.d b.d b.d: class B forward reference of base class A -- andy
Jan 19 2004
On Mon, 19 Jan 2004 18:45:19 -0800, Andy Friesen wrote:Maybe this has been posted before, but I don't recall anybody managing to isolate this into a handful of lines of code, so I may as well post it now. (apologies if it has already been posted) a.d: import b; class A { B[] b; } b.d: import a; class B : A { } D:\temp\dtest>dmd a.d b.d b.d: class B forward reference of base class A -- andyI was going to suggest: module A; class A { private import B; B b; } module B; import A; class B : A { } but that kinda segfaults the compiler (0.78) even if we remove the "module" statments. which if funny because the test I done before works fine: class A { private import std.string; void a() { printf("A.a std.string.toString(1)== %.*s\n",std.string.toString(1)); } } private import ImpA; class B { private import std.string; void b() { printf("B.b std.string.toString(2)== %.*s\n",std.string.toString(2)); } } void main() { B b = new B; b.b(); } Ant
Jan 19 2004
On Mon, 19 Jan 2004 22:08:38 -0500, Ant wrote: ok forget the second test. I guess it was to test something else. I have a directory full of these simple tests... Ant
Jan 19 2004
On Mon, 19 Jan 2004 22:11:06 -0500, Ant wrote:On Mon, 19 Jan 2004 22:08:38 -0500, Ant wrote: ok forget the second test. I guess it was to test something else. I have a directory full of these simple tests... AntOK I went back to that second test. If class B : A still compiles which shows the point I was trying to make. if class B : A (again) and remove the import std.string from class B the it still compiles and ouputs "B.b std.string.toString(2)== 2" that shows that the "private" in "private import std.string" inside the body definition of A is not respected in B Ant
Jan 19 2004
Ant wrote:On Mon, 19 Jan 2004 22:11:06 -0500, Ant wrote:I also reported on this with minimal examples some time ago. Disrespect of the 'private' keyword for modules seemed to be the main problem. Lars Ivar IgesundOn Mon, 19 Jan 2004 22:08:38 -0500, Ant wrote: ok forget the second test. I guess it was to test something else. I have a directory full of these simple tests... AntOK I went back to that second test. If class B : A still compiles which shows the point I was trying to make. if class B : A (again) and remove the import std.string from class B the it still compiles and ouputs "B.b std.string.toString(2)== 2" that shows that the "private" in "private import std.string" inside the body definition of A is not respected in B Ant
Jan 20 2004