GLBasic forum

Main forum => Bug Reports => Topic started by: ampos on 2010-Sep-24

Title: Strange error with DIMs and TYPES
Post by: ampos on 2010-Sep-24
I have this:

Code: (glbasic) [Select]
TYPE casillas;x;y;tipo;explo;ENDTYPE
GLOBAL lad#[] AS casillas
DIM lad#[12][9] //matriz de los ladrillos
I f I write

Code: (glbasic) [Select]
If lad[x][y].tipo=4 then blahblah
all is fine. BUT if I forgot the .tipo...

Code: (glbasic) [Select]
If lad[x][y]=4 then blahblah
I got a HUGE and strange error:

Code: (glbasic) [Select]
compiling:
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp: In function `DGInt __GLBASIC__::pintaladrillos()':
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:533: error: no match for 'operator==' in '(&__GLBASIC__::lad)->__GLBASIC__::DGArray<T>::operator() [with T = __GLBASIC__::casillas](#`fix_trunc_expr' not supported by dump_expr#<expression error>, #`fix_trunc_expr' not supported by dump_expr#<expression error>) == 0'
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp.h:172: note: candidates are: bool __GLBASIC__::casillas::operator==(const __GLBASIC__::casillas&) const
D:/Programas/GLBasic/Compiler/platform/Include/glb.h:304: note:                 bool __GLBASIC__::operator==(int, __GLBASIC__::CGStr)
D:/Programas/GLBasic/Compiler/platform/Include/glb.h:304: note:                 bool __GLBASIC__::operator==(int, const __GLBASIC__::DGStr&)
D:/Programas/GLBasic/Compiler/platform/Include/glb.h:304: note:                 bool __GLBASIC__::operator==(float, __GLBASIC__::CGStr)
D:/Programas/GLBasic/Compiler/platform/Include/glb.h:304: note:                 bool __GLBASIC__::operator==(float, const __GLBASIC__::DGStr&)
D:/Programas/GLBasic/Compiler/platform/Include/glb.h:304: note:                 bool __GLBASIC__::operator==(double, __GLBASIC__::CGStr)
D:/Programas/GLBasic/Compiler/platform/Include/glb.h:304: note:                 bool __GLBASIC__::operator==(double, const __GLBASIC__::DGStr&)
D:/Programas/GLBasic/Compiler/platform/Include/glb.h:304: note:                 bool __GLBASIC__::operator==(__GLBASIC__::CGStr, __GLBASIC__::CGStr)
D:/Programas/GLBasic/Compiler/platform/Include/glb.h:304: note:                 bool __GLBASIC__::operator==(__GLBASIC__::CGStr, const __GLBASIC__::DGStr&)
D:/Programas/GLBasic/Compiler/platform/Include/glb.h:304: note:                 bool __GLBASIC__::operator==(__GLBASIC__::CGStr, int)
D:/Programas/GLBasic/Compiler/platform/Include/glb.h:304: note:                 bool __GLBASIC__::operator==(__GLBASIC__::CGStr, float)
D:/Programas/GLBasic/Compiler/platform/Include/glb.h:304: note:                 bool __GLBASIC__::operator==(__GLBASIC__::CGStr, double)
D:/Programas/GLBasic/Compiler/platform/Include/glb.h:304: note:                 bool __GLBASIC__::operator==(const __GLBASIC__::DGStr&, __GLBASIC__::CGStr)
D:/Programas/GLBasic/Compiler/platform/Include/glb.h:304: note:                 bool __GLBASIC__::operator==(const __GLBASIC__::DGStr&, const __GLBASIC__::DGStr&)
D:/Programas/GLBasic/Compiler/platform/Include/glb.h:304: note:                 bool __GLBASIC__::operator==(const __GLBASIC__::DGStr&, int)
D:/Programas/GLBasic/Compiler/platform/Include/glb.h:304: note:                 bool __GLBASIC__::operator==(const __GLBASIC__::DGStr&, float)
D:/Programas/GLBasic/Compiler/platform/Include/glb.h:304: note:                 bool __GLBASIC__::operator==(const __GLBASIC__::DGStr&, double)
D:/Programas/GLBasic/Compiler/platform/Include/glb.h:311: note:                 bool __GLBASIC__::operator==(const __GLBASIC__::DGStr&, const char*)
D:/Programas/GLBasic/Compiler/platform/Include/glb.h:312: note:                 bool __GLBASIC__::operator==(const char*, const __GLBASIC__::DGStr&)
*** FATAL ERROR - Please post this output in the forum

(not checked if same error in normal types instead of DIM types)

Wouldnt it be better a single "syntax error on line..."?

 :S
Title: Re: Strange error with DIMs and TYPES
Post by: MrTAToad on 2010-Sep-24
yes, would be nice :)
Title: Re: Strange error with DIMs and TYPES
Post by: Scott_AW on 2010-Sep-24
I get those when I break out of array boundaries, but I don't think you can reference a type dim by itself.  I don't know why you would need to.

I'm guessing when you do that it throws it out of range as well.
Title: Re: Strange error with DIMs and TYPES
Post by: hardyx on 2010-Sep-24
I think you are using two types defining the array. The type # (double) and the type casillas. Maybe the compiler not knows the type to apply in this case. If you want the fields of casillas be double, put # in this, but not in the DIM.
Title: Re: Strange error with DIMs and TYPES
Post by: ampos on 2010-Sep-24
I think you are using two types defining the array. The type # (double) and the type casillas. Maybe the compiler not knows the type to apply in this case. If you want the fields of casillas be double, put # in this, but not in the DIM.

Nah, it just an error when you forgot to type the "type extension" on a var. At least if the missing extension is in an array.