compiler icon indicating copy to clipboard operation
compiler copied to clipboard

Function tags conflict with class specifiers in `forward` declarations

Open Daniel-Cortez opened this issue 4 years ago • 4 comments

Issue description:

The following code compiles correctly:

forward public Func();

But when specifying a tag for the return value, it won't compile

forward public Tag:Func(); // error 010: invalid function or declaration

, although if the class specifier is removed, it would compile just fine:

forward Tag:Func(); // no errors

Minimal complete verifiable example (MCVE):

See above.

Workspace Information:

  • Compiler version: 3.10.10, 3.2.3664
  • Command line arguments provided (or sampctl version):
  • Operating System:

Daniel-Cortez avatar Feb 11 '21 12:02 Daniel-Cortez

Checked the code in function funcstub() (file sc1.c); apparently the compiler expects the tag before the class specifier (which is obviously a bug), so, for example, this code

forward Tag:public Func();

surprisingly compiles.

Daniel-Cortez avatar Feb 11 '21 14:02 Daniel-Cortez

Possibly related to https://github.com/pawn-lang/compiler/issues/618 ?

BitFros7y avatar Mar 24 '21 18:03 BitFros7y

Possibly related to #618 ?

No, that one is related to function arguments, while this bug affects the tag of the function itself. Also, what you described in your issue is intended behavior (although I agree it might seem counter-intuitive at times) while this one clearly isn't.

Daniel-Cortez avatar Mar 25 '21 04:03 Daniel-Cortez

This issue has been automatically marked as stale because it has not had recent activity.

stale[bot] avatar Jul 13 '21 01:07 stale[bot]