On Wednesday, 5 June 2013 at 20:37:27 UTC, Timon Gehr wrote:
On 06/05/2013 10:34 PM, Johan F. wrote:
I'm fiddling around with SDL2 using Derelict3, and I'm trying
to make an
array of SDL_Texture pointers, like so:
SDL_Texture*[] frames;
... make texture ...
frames ~= texture;
However, this yields the following error:
/Users/jaffe1/prog/Derelict3/import/derelict/sdl2/types.d(1865):
Error:
struct derelict.sdl2.types.SDL_Texture is forward referenced
when
looking for 'toHash'
/Users/jaffe1/prog/Derelict3/import/derelict/sdl2/types.d(1865):
Error:
struct derelict.sdl2.types.SDL_Texture is forward referenced
when
looking for 'opCmp'
/Users/jaffe1/prog/Derelict3/import/derelict/sdl2/types.d(1865):
Error:
struct derelict.sdl2.types.SDL_Texture is forward referenced
when
looking for 'toString'
/Users/jaffe1/prog/Derelict3/import/derelict/sdl2/types.d(1865):
Error:
struct derelict.sdl2.types.SDL_Texture unknown size
/Users/jaffe1/prog/Derelict3/import/derelict/sdl2/types.d(1865):
Error:
struct derelict.sdl2.types.SDL_Texture no size yet for forward
reference
/Users/jaffe1/prog/Derelict3/import/derelict/sdl2/types.d(1865):
Error:
struct derelict.sdl2.types.SDL_Texture unknown size
/Users/jaffe1/prog/Derelict3/import/derelict/sdl2/types.d(1865):
Error:
struct derelict.sdl2.types.SDL_Texture no size yet for forward
reference
At line 1865 in types.d is the opaque struct declaration
struct SDL_Texture;
The program compiles and works fine if I change this line to
struct SDL_Texture {};
This seems weird to me. Why is making an array of _pointers_ to
SDL_Texture dependant on how the SDL_Texture struct is
declared? Also,
is simply adding {} the right way of fixing it, or will that
possibly
break something else?
It is a compiler bug, but we cannot confirm it unless you
provide a minimal example that triggers it.
This triggers it (2.063):
struct something;
int main()
{
something*[] stuff;
something* a;
stuff ~= a;
return 0;
}