[ZScript] Empty structs not supported?

Is there something that doesn't work right in the latest GZDoom? Post about it here.

Moderator: GZDoom Developers

Forum rules
Please construct and post a simple demo whenever possible for all bug reports. Please provide links to everything.

If you can include a wad demonstrating the problem, please do so. Bug reports that include fully-constructed demos have a much better chance of being investigated in a timely manner than those that don't.

Please make a new topic for every bug. Don't combine multiple bugs into a single topic. Thanks!

[ZScript] Empty structs not supported?

Postby Sebelino » Sat May 26, 2018 2:49 pm

My apologies if I am posting this in the wrong subforum.

It looks like it is not possible to compile ZScript code that defines a struct with no member variables and an actor that makes use of it:
Code: Select allExpand view
struct MyStruct {
  //int m_foo;  // Uncomment to make it compile

  void do_stuff() {
    // ...

class MyActor : Actor {
  MyStruct m_my_struct;

Code: Select allExpand view
GZDoom g3.3.2-m - 2018-04-12 21:44:48 +0200 - SDL version
Compiled on May 14 2018

M_LoadDefaults: Load system defaults.
W_Init: Init WADfiles.
 adding /usr/share/gzdoom/gzdoom.pk3, 684 lumps
 adding /usr/share/gzdoom/zd_extra.pk3, 132 lumps
 adding /home/sebelino/.config/gzdoom/doom2.wad, 2919 lumps
 adding testmod, 1 lumps
I_Init: Setting up machine state.
CPU Vendor ID: GenuineIntel
  Name: Intel(R) Core(TM) i7-3517U CPU @ 1.90GHz
  Family 6, Model 58, Stepping 9
  Features: SSE2 SSE3 SSSE3 SSE4.1 SSE4.2 HyperThreading
I_InitSound: Initializing OpenAL
  Opened device Built-in Audio Analog Stereo
  EFX enabled
V_Init: allocate screen.
S_Init: Setting up sound.
ST_Init: Init startup screen.
Checking cmd-line parameters...
S_InitData: Load sound definitions.
G_ParseMapInfo: Load map definitions.
Texman.Init: Init texture manager.
ParseTeamInfo: Load team definitions.
LoadActors: Load actor definitions.
:zscript.txt, line 9: Unable to resolve all fields for class MyActor
1 errors, 0 warnings while compiling :zscript.txt

Is this intentional? If so, I think it is worth to clarify the error message. It took some time to figure out the cause of the error.
User avatar
Joined: 28 May 2017

Re: [ZScript] Empty structs not supported?

Postby Graf Zahl » Mon May 28, 2018 11:47 am

It's an error for sure, it's just that the actual condition is never explicitly checked.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Joined: 19 Jul 2003
Location: Germany

Return to Bugs

Who is online

Users browsing this forum: No registered users and 0 guests