File tree Expand file tree Collapse file tree 4 files changed +37
-2
lines changed Expand file tree Collapse file tree 4 files changed +37
-2
lines changed Original file line number Diff line number Diff line change @@ -1710,8 +1710,8 @@ function cVarDecl _
17101710 else
17111711 '' default initialization
17121712 if ( sym ) then
1713- '' Byref? Always requires an explicit initializer
1714- if ( symbIsRef( sym ) ) then
1713+ '' Allocating a Byref variable ? Always requires an explicit initializer
1714+ if ( ( not symbIsExtern( sym )) and symbIsRef( sym ) ) then
17151715 errReport( FB_ERRMSG_MISSINGREFINIT )
17161716 hSkipStmt( )
17171717 exit function
Original file line number Diff line number Diff line change 1+ namespace fbc_tests.dim_.byref_
2+ namespace externs
3+ extern i as integer
4+ extern byref ri as integer
5+ type SomeUDT
6+ dummy as integer
7+ static i as integer
8+ static byref ri as integer
9+ end type
10+ end namespace
11+ end namespace
Original file line number Diff line number Diff line change 11#include "fbcu.bi"
2+ #include "byref-common.bi"
23
34namespace fbc_tests.dim_.byref_
45
@@ -583,13 +584,25 @@ namespace privateDtor
583584 end sub
584585end namespace
585586
587+ namespace externs
588+ sub test cdecl( )
589+ CU_ASSERT( @ri = @i )
590+ CU_ASSERT( @SomeUDT.ri = @SomeUDT.i )
591+ CU_ASSERT( i = &hEE112233 )
592+ CU_ASSERT( ri = &hEE112233 )
593+ CU_ASSERT( SomeUDT.i = &hEE445566 )
594+ CU_ASSERT( SomeUDT.ri = &hEE445566 )
595+ end sub
596+ end namespace
597+
586598private sub ctor( ) constructor
587599 fbcu.add_suite( "tests/dim/byref" )
588600 fbcu.add_test( "simpleVars" , @simpleVars.test )
589601 fbcu.add_test( "allDtypes" , @allDtypes.test )
590602 fbcu.add_test( "callByrefFunctionPtrThroughByref" , @callByrefFunctionPtrThroughByref.test )
591603 fbcu.add_test( "noCtorsCalled" , @noCtorsCalled.test )
592604 fbcu.add_test( "privateDtor" , @privateDtor.test )
605+ fbcu.add_test( "externs" , @externs.test )
593606end sub
594607
595608end namespace
Original file line number Diff line number Diff line change 1+ #include "fbcu.bi"
2+ #include "byref-common.bi"
3+
4+ namespace fbc_tests.dim_.byref_
5+ namespace externs
6+ dim shared i as integer = &hEE112233
7+ dim shared byref ri as integer = i
8+ dim shared SomeUDT.i as integer = &hEE445566
9+ dim shared byref SomeUDT.ri as integer = SomeUDT.i
10+ end namespace
11+ end namespace
You can’t perform that action at this time.
0 commit comments