[ZScript] Empty structs not supported?

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:
struct MyStruct {
  //int m_foo;  // Uncomment to make it compile

  void do_stuff() {
    // ...
  }
}

class MyActor : Actor {
  MyStruct m_my_struct;
}

Code:
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.

Re: [ZScript] Empty structs not supported?

Mon May 28, 2018 11:47 am

It's an error for sure, it's just that the actual condition is never explicitly checked.