Re: error forward references if scope

2022-03-12 Thread Salih Dincer via Digitalmars-d-learn
On Saturday, 12 March 2022 at 13:12:25 UTC, vit wrote: ```d enum touch_T = __traits(hasMember, T, "touch"); ``` I think you meant build instead of touch? ```d struct Query { public const SharedPtr!Builder builder; } interface Builder { void build(ref Query query); } struct SharedPtr(T) {

error forward references if scope

2022-03-12 Thread vit via Digitalmars-d-learn
} ``` ``` src/app.d(3,1): Error: no size because of forward references src/app.d(4,18): Error: template instance `app.SharedPtr!(Builder)` error instantiating ```

Re: Forward references

2021-06-10 Thread Elmar via Digitalmars-d-learn
Hello there, I got a weird compilation error which was hard to debug (even for just a little program) and I thought, this is quite related to this thread. This is my error message: ``` ***search.d(42,1): Error: class ***.XXX has forward references ***box.d(21,32): Error: template instance

Re: std.container.array: Error: unable to determine fields of Test because of forward references

2019-10-31 Thread Tobias Pankrath via Digitalmars-d-learn
On Thursday, 31 October 2019 at 12:37:55 UTC, user1234 wrote: struct S { S*[] children; } because otherwise when you declare the array the compiler has not finished the semantic ana of S. --- struct Test { Test[] t; } --- Works today. Putting pointers into the container (and thus ha

Re: std.container.array: Error: unable to determine fields of Test because of forward references

2019-10-31 Thread user1234 via Digitalmars-d-learn
On Thursday, 31 October 2019 at 12:37:55 UTC, user1234 wrote: On Thursday, 31 October 2019 at 12:29:28 UTC, Tobias Pankrath wrote: [...] Try struct S { S*[] children; } because otherwise when you declare the array the compiler has not finished the semantic ana of S. so S size is not

Re: std.container.array: Error: unable to determine fields of Test because of forward references

2019-10-31 Thread user1234 via Digitalmars-d-learn
On Thursday, 31 October 2019 at 12:29:28 UTC, Tobias Pankrath wrote: My Problem: --- (https://run.dlang.io/is/CfLscj) import std.container.array; import std.traits; struct Test { Test[] t; } struct Test2 { Array!Test2 t; } int main() { return FieldTypeTuple!Test.length + FieldTy

std.container.array: Error: unable to determine fields of Test because of forward references

2019-10-31 Thread Tobias Pankrath via Digitalmars-d-learn
My Problem: --- (https://run.dlang.io/is/CfLscj) import std.container.array; import std.traits; struct Test { Test[] t; } struct Test2 { Array!Test2 t; } int main() { return FieldTypeTuple!Test.length + FieldTypeTuple!Test2; } --- I've found https://issues.dlang.org/show_bug.cgi

Re: class X has forward references

2018-06-12 Thread Ali Çehreli via Digitalmars-d-learn
tor { // ... override void visit(AggregateDeclaration ad) { //printf("AggregateDeclaration::semantic2(%s) type = %s, errors = %d\n", ad.toChars(), ad.type.toChars(), ad.errors); if (!ad.members) return; if (ad._scope) { ad.error

Re: class X has forward references

2018-06-12 Thread bauss via Digitalmars-d-learn
On Tuesday, 12 June 2018 at 20:30:22 UTC, Steven Schveighoffer wrote: On 6/12/18 4:14 PM, bauss wrote: What could cause that error? I cannot find anything in the documentation nor does the error message itself give much information. A forward reference that can't be figured out by the compil

Re: class X has forward references

2018-06-12 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/12/18 4:14 PM, bauss wrote: What could cause that error? I cannot find anything in the documentation nor does the error message itself give much information. A forward reference that can't be figured out by the compiler. This is one of the DMD front end's real weak spots. I can't real

class X has forward references

2018-06-12 Thread bauss via Digitalmars-d-learn
What could cause that error? I cannot find anything in the documentation nor does the error message itself give much information. I can't really give a good example, but I can tell as much as I have a few inheritances of classes using templates. I just don't think that would be the issue.

Re: Forward references

2018-02-25 Thread Steven Schveighoffer via Digitalmars-d-learn
still seems to be some strangeness about forward references. There are frequently issues with forward references. They are supposed to always work, but it's not always the case. -Steve

Re: Forward references

2018-02-25 Thread Jiyan via Digitalmars-d-learn
about forward references. Thanks till now i guess :P

Re: Forward references

2018-02-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/25/18 4:25 PM, Jiyan wrote: Hi, is there any document or text describing forward references? It is kinda strange, i implemented a list structure which is kinda like this: struct list(T) { private: struct node { T val; node* next; node* prev; } node* head; node* last; size_t size

Re: Forward references

2018-02-25 Thread ketmar via Digitalmars-d-learn
works for me with 2.076.

Forward references

2018-02-25 Thread Jiyan via Digitalmars-d-learn
Hi, is there any document or text describing forward references? It is kinda strange, i implemented a list structure which is kinda like this: struct list(T) { private: struct node { T val; node* next; node* prev; } node* head; node* last; size_t size; . } The thing is when i

Forward References

2016-06-27 Thread Jonathan Marler via Digitalmars-d-learn
Do the various D compilers use multiple passes to handle forward references or some other technique?

Re: Forward references and more

2009-10-13 Thread Steven Schveighoffer
On Tue, 13 Oct 2009 07:30:11 -0400, bearophile wrote: Steven Schveighoffer: A static variable is essentially a scoped global variable. I think it will work if you make it static. I've used plenty of static variables that are instances of the struct they are declared in. It doesn't compi

Re: Forward references and more

2009-10-13 Thread bearophile
Steven Schveighoffer: > A static variable is essentially a scoped global variable. I think it > will work if you make it static. I've used plenty of static variables > that are instances of the struct they are declared in. It doesn't compile with static variables too, you just need few seco

Re: Forward references and more

2009-10-12 Thread Steven Schveighoffer
On Mon, 12 Oct 2009 15:38:07 -0400, bearophile wrote: Steven Schveighoffer: It looks strange what you are doing. A Foo can have a memory pool of a lot of Foo's? Do you mean to make the memory pool static? Right and yes. I think that might work.< It works if I use a global variable.

Re: Forward references and more

2009-10-12 Thread bearophile
Ary Borenszweig: > I can see MemoryPool!(Foo) sizeof doesn't depend at all of T.sizeof > because it just has a pointer. Well, a dynamic array of pointers, but the situation is the same. >But how do you suggest to fix the compiler to understand that?< I don't know. I don't know enough about co

Re: Forward references and more

2009-10-12 Thread Ary Borenszweig
Steven Schveighoffer wrote: On Mon, 12 Oct 2009 05:26:58 -0400, bearophile wrote: What's wrong with this code? struct MemoryPool(T) { alias T[100_000 / T.sizeof] Chunk; Chunk*[] chunks; } struct Foo { int x; MemoryPool!(Foo) pool; } void main() {} It prints "Error: struct pr

Re: Forward references and more

2009-10-12 Thread bearophile
Steven Schveighoffer: > It looks strange what you are doing. A Foo can have a memory pool of a > lot of Foo's? Do you mean to make the memory pool static? Right and yes. >I think that might work.< It works if I use a global variable. But I'd like to not used global variables when possible

Re: Forward references and more

2009-10-12 Thread Steven Schveighoffer
On Mon, 12 Oct 2009 05:26:58 -0400, bearophile wrote: What's wrong with this code? struct MemoryPool(T) { alias T[100_000 / T.sizeof] Chunk; Chunk*[] chunks; } struct Foo { int x; MemoryPool!(Foo) pool; } void main() {} It prints "Error: struct problem.Foo no size yet for fo

Re: Forward references and more

2009-10-12 Thread bearophile
> T.sizeof must be 8 in all cases. Ignore this line, please :-)

Forward references and more

2009-10-12 Thread bearophile
What's wrong with this code? struct MemoryPool(T) { alias T[100_000 / T.sizeof] Chunk; Chunk*[] chunks; } struct Foo { int x; MemoryPool!(Foo) pool; } void main() {} It prints "Error: struct problem.Foo no size yet for forward reference". T.sizeof must be 8 in all cases. So I ha

Re: x has forward references

2009-08-16 Thread Jos van Uden
Spacen Jasset Wrote: > Jos van Uden wrote: > > Jacob Carlborg Wrote: > > > >> On 8/16/09 19:36, Jos van Uden wrote: > >>> Jacob Carlborg Wrote: > >>> > It works with dmd 1.045 > >>> Where to get it? > >> http://www.digitalmars.com/d/1.0/changelog.html#new1_045 > > > > Thank you. This versio

Re: x has forward references

2009-08-16 Thread Spacen Jasset
Jos van Uden wrote: Jacob Carlborg Wrote: On 8/16/09 19:36, Jos van Uden wrote: Jacob Carlborg Wrote: It works with dmd 1.045 Where to get it? http://www.digitalmars.com/d/1.0/changelog.html#new1_045 Thank you. This version does indeed compile the libs, just like 1.033, but I still get

Re: x has forward references

2009-08-16 Thread Jos van Uden
Jacob Carlborg Wrote: > On 8/16/09 19:36, Jos van Uden wrote: > > Jacob Carlborg Wrote: > > > >> It works with dmd 1.045 > > > > Where to get it? > > http://www.digitalmars.com/d/1.0/changelog.html#new1_045 Thank you. This version does indeed compile the libs, just like 1.033, but I still get t

Re: x has forward references

2009-08-16 Thread Jacob Carlborg
On 8/16/09 19:36, Jos van Uden wrote: Jacob Carlborg Wrote: It works with dmd 1.045 Where to get it? http://www.digitalmars.com/d/1.0/changelog.html#new1_045 I also tried compiling derelict today. I finally managed to get past the error messages by using the dmd compiler that ships with

Re: x has forward references

2009-08-16 Thread Jos van Uden
Jacob Carlborg Wrote: > It works with dmd 1.045 Where to get it? I also tried compiling derelict today. I finally managed to get past the error messages by using the dmd compiler that ships with tango. 1.033 if I remember correctly. The lib folder filled up nicely with files. Then I did a dsss

Re: x has forward references

2009-08-14 Thread Spacen Jasset
Spacen Jasset wrote: Hello, trying to use deteclit with the latest version of dmd 1.047 and I get this error. I don't understand what it means: derelict\freetype\fttypes.d(827): Error: struct derelict.freetype.fttypes.FT_RasterRec has forward references line 97: alias FT_Rast

Re: x has forward references

2009-08-13 Thread Jacob Carlborg
On 8/13/09 17:01, Spacen Jasset wrote: Hello, trying to use deteclit with the latest version of dmd 1.047 and I get this error. I don't understand what it means: derelict\freetype\fttypes.d(827): Error: struct derelict.freetype.fttypes.FT_RasterRec has forward references line 97:

x has forward references

2009-08-13 Thread Spacen Jasset
Hello, trying to use deteclit with the latest version of dmd 1.047 and I get this error. I don't understand what it means: derelict\freetype\fttypes.d(827): Error: struct derelict.freetype.fttypes.FT_RasterRec has forward references line 97: alias FT_RasterRec* FT_Raster;