Merge pull request #135 from alliedmodders/typedef-fix
Fix typedefs not fixing string sizes (bug 6220).
This commit is contained in:
commit
233aa5d2df
@ -4223,6 +4223,9 @@ static void parse_function_type(functag_t *type)
|
||||
continue;
|
||||
}
|
||||
|
||||
// Account for strings.
|
||||
fix_char_size(&decl);
|
||||
|
||||
funcarg_t *arg = &type->args[type->argcount++];
|
||||
arg->tagcount = 1;
|
||||
arg->tags[0] = decl.type.tag;
|
||||
|
26
sourcepawn/compiler/tests/ok-typedef-func-chars.sp
Normal file
26
sourcepawn/compiler/tests/ok-typedef-func-chars.sp
Normal file
@ -0,0 +1,26 @@
|
||||
enum Action: {}
|
||||
functag public Action:OldFuncTag( String:someString[128] );
|
||||
typedef NewFuncTag = function Action ( char someString[128] );
|
||||
|
||||
native UseOldFuncTag( OldFuncTag func );
|
||||
native UseNewFuncTag( NewFuncTag func );
|
||||
|
||||
public OnPluginStart()
|
||||
{
|
||||
// fine
|
||||
UseOldFuncTag( MyOldFunc );
|
||||
// also fine
|
||||
UseOldFuncTag( MyNewFunc );
|
||||
|
||||
// error 100: function prototypes do not match
|
||||
UseNewFuncTag( MyOldFunc );
|
||||
// error 100: function prototypes do not match
|
||||
UseNewFuncTag( MyNewFunc );
|
||||
}
|
||||
|
||||
public Action:MyOldFunc( String:someString[128] )
|
||||
{
|
||||
}
|
||||
public Action MyNewFunc( char someString[128] )
|
||||
{
|
||||
}
|
Loading…
Reference in New Issue
Block a user