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

[BUG?] Sub methodmap array can't pass in functions whose parameter are parent methodmap array #1022

Open
F1F88 opened this issue Feb 6, 2025 · 0 comments

Comments

@F1F88
Copy link

F1F88 commented Feb 6, 2025

This code can be compiled in sourcemod-1.12.0-git7164, but it will compile with an error starting from sourcemod-1.12.0-git7165:

error 450: no viable conversion from "MyHandle3[1]" to "MyHandle2[]"
#include <sourcemod>

methodmap MyHandle < Handle {
    public static native MyHandle CreateWith(MyHandle2[] handles, int size);
}

methodmap MyHandle2 < Handle {
}

methodmap MyHandle3 < MyHandle2 {
    public native MyHandle3();
}

stock void DoSomething()
{
    const int size = 1;
    MyHandle3 handles[size];
    handles[0] = new MyHandle3();

    // error 450
    MyHandle.CreateWith(handles, size);

    // Can be compiled
    // MyHandle.CreateWith(view_as<MyHandle2>(handles), size);
}

If it is intentional, I think warnings are better than errors from the perspective of code compatibility.

And too many view_as\<...\>(...) make the code look bloated

Possibly relevant: #973

@F1F88 F1F88 changed the title [BUG?] Sub methodmap can't pass in functions whose parameter are parent methodmap [BUG?] Sub methodmap array can't pass in functions whose parameter are parent methodmap array Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant