diff --git a/sourcepawn/compiler/sc1.cpp b/sourcepawn/compiler/sc1.cpp index d8e5f037..f362b86b 100644 --- a/sourcepawn/compiler/sc1.cpp +++ b/sourcepawn/compiler/sc1.cpp @@ -5645,7 +5645,7 @@ static int declargs(symbol *sym, int chkshadow, const int *thistag) if (argcnt>=sMAXARGS) error(45); if (decl.name[0] == PUBLIC_CHAR) - error(56,name); /* function arguments cannot be public */ + error(56, decl.name); /* function arguments cannot be public */ if (decl.type.ident == iARRAY) decl.type.ident = iREFARRAY; @@ -5659,7 +5659,7 @@ static int declargs(symbol *sym, int chkshadow, const int *thistag) doarg(&decl,(argcnt+3)*sizeof(cell),fpublic,chkshadow,&arg); if ((sym->usage & uPUBLIC) && arg.hasdefault) - error(59,name); /* arguments of a public function may not have a default value */ + error(59, decl.name); /* arguments of a public function may not have a default value */ if ((sym->usage & uPROTOTYPED)==0) { /* redimension the argument list, add the entry */ diff --git a/sourcepawn/compiler/tests/fail-default-args-in-public.sp b/sourcepawn/compiler/tests/fail-default-args-in-public.sp new file mode 100644 index 00000000..97a39802 --- /dev/null +++ b/sourcepawn/compiler/tests/fail-default-args-in-public.sp @@ -0,0 +1 @@ +public x(param = 1) {} diff --git a/sourcepawn/compiler/tests/fail-default-args-in-public.txt b/sourcepawn/compiler/tests/fail-default-args-in-public.txt new file mode 100644 index 00000000..01947b24 --- /dev/null +++ b/sourcepawn/compiler/tests/fail-default-args-in-public.txt @@ -0,0 +1 @@ +(1) : error 059: function argument may not have a default value (variable "param")