Skip to content

Commit 1c06afd

Browse files
committed
varargs: don't allow 'any alias "modifier"' types unless also a pointer
1 parent 8c8e206 commit 1c06afd

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/compiler/parser-decl-var.bas

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ sub hSymbolType _
6565
lgt = typeGetSize( dtype )
6666
end if
6767

68+
'' ANY alias "modifier" but no pointer level?
69+
if( typeHasMangleDt( dtype ) and (typeGetDtAndPtrOnly( dtype ) = FB_DATATYPE_VOID) ) then
70+
errReport( FB_ERRMSG_INVALIDDATATYPES )
71+
'' error recovery: fake a type
72+
dtype = typeAddrOf( dtype )
73+
subtype = NULL
74+
lgt = typeGetSize( dtype )
75+
end if
76+
6877
end sub
6978

7079
function hCheckScope() as integer

tests/dim/dim-bad-datatype-1.bas

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
' TEST_MODE : COMPILE_ONLY_FAIL
2+
3+
dim x as any alias "char"

0 commit comments

Comments
 (0)