bmx-ng / bcc

A next-generation bcc parser for BlitzMax
zlib License
33 stars 12 forks source link

Var-passed "New Struct" not catched #587

Closed GWRon closed 2 years ago

GWRon commented 2 years ago
SuperStrict

Struct STest
    Field i:Int

    Method New(i:Int)
        Self.i = i
    End Method
End Struct

Function PassStruct(s:STest Var)
End Function

PassStruct(New STest(10))

This creates invalid C code but might better throw an error? (tried with most current bcc, brl, pub ...)

[ 84%] Compiling:untitled1.bmx.console.release.linux.x64.c
/BlitzMaxNG/tmp/.bmx/untitled1.bmx.console.release.linux.x64.c: In function ‘_bb_main’:
/BlitzMaxNG/tmp/.bmx/untitled1.bmx.console.release.linux.x64.c:129:27: error: incompatible type for argument 1 of ‘_m_untitled1_PassStruct’
   _m_untitled1_PassStruct(bbt_);
                           ^~~~
/BlitzMaxNG/tmp/.bmx/untitled1.bmx.console.release.linux.x64.c:65:6: note: expected ‘struct _m_untitled1_STest *’ but argument is of type ‘struct _m_untitled1_STest’
 void _m_untitled1_PassStruct(struct _m_untitled1_STest* bbt_s){
      ^~~~~~~~~~~~~~~~~~~~~~~
Build Error: failed to compile (256) /BlitzMaxNG/tmp/.bmx/untitled1.bmx.console.release.linux.x64.c
Process complete