[ZScript] Empty structs not supported?

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!

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is ON
[img] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: [ZScript] Empty structs not supported?

Re: [ZScript] Empty structs not supported?

by 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.

[ZScript] Empty structs not supported?

by 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 all

struct MyStruct {
  //int m_foo;  // Uncomment to make it compile

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

class MyActor : Actor {
  MyStruct m_my_struct;
}

Code: Select all

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.

Top