Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enum Struct function - No warning on missing parenthesis #406

Closed
JoinedSenses opened this issue Nov 4, 2019 · 1 comment
Closed

Enum Struct function - No warning on missing parenthesis #406

JoinedSenses opened this issue Nov 4, 2019 · 1 comment
Labels

Comments

@JoinedSenses
Copy link
Contributor

Uncertain if intentional, spcomp doesn't warn upon use of ES function without parenthesis. Not sure if it would ever be useful in any manner to call function without parenthesis. Tested with 1.10.0-git6380 and 1.11.0-git6460

#include <sourcemod>

enum struct Whatever {
	int x;
	char whatever[32];
	int test() {
		return sizeof Whatever::whatever;
	}
}

public void OnPluginStart() {
	RegAdminCmd("sm_test", cmdTest, ADMFLAG_ROOT);
}

public Action cmdTest(int client, int args) {
	Whatever w;
	ReplyToCommand(client, "%i %i", w.test, w.test()); // 0 32
	return Plugin_Handled;
}
@dvander dvander added the bug label Dec 2, 2019
@dvander
Copy link
Member

dvander commented Dec 2, 2019

This is indeed a bug. The new expression parser is much more flexible, and effectively evaluates "w.test" to a bound function. The old parser did not support this at all, and since the semantic checks are mostly the same, we're missing type checks for this situation.

@Fyren Fyren closed this as completed in 5c7078e Dec 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants