Skip to content

tagof operator as default argument does not evaluate properly if default arguments are used #268

Closed
@YashasSamaga

Description

@YashasSamaga
#include <a_samp>
f({Tag1, Tag2}:a = Tag1:123, b = tagof(a)) {
	printf("b: %d", _:b);
}

main () {
	new Tag21:x;
	printf("Tag21: %d, Tag1: %d, Tag2: %d", tagof(Tag21:), tagof(Tag1:), tagof(Tag2:));
	f();
}

gives

Tag21: -1073741807, Tag1: -1073741809, Tag2: -1073741808
b: 0

The value of b shouldn't be zero. As the default argument is Tag1:123, b should have had the tag identifier of Tag1.

If f is called with an argument, it works fine.

With f() replaced with f(x):

Tag21: -1073741807, Tag1: -1073741809, Tag2: -1073741808
b: -1073741807

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions