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

Mismatch on field/getter fails only on mac cpp #11822

Open
Geokureli opened this issue Nov 12, 2024 · 1 comment
Open

Mismatch on field/getter fails only on mac cpp #11822

Geokureli opened this issue Nov 12, 2024 · 1 comment
Labels
platform-cpp Everything related to CPP / C++

Comments

@Geokureli
Copy link

Geokureli commented Nov 12, 2024

The following results in an error on my mac

class Test {
  static function main() {
    new Object().run();
  }
}

class Object extends Derived
{
    var top(get, default):Base;
    function get_top():Derived // Note: not a Base
    {
        return this;
    }
    
    public function run()
    {
        trace(top);
    }
}

class Base {}
class Derived extends Base { public function new () {} }

The error is

Error: ./src/states/Test.cpp:107:86: error: conditional expression is ambiguous; 'ObjectPtrstates::Derived_obj' can be converted to 'ObjectPtrstates::Base_obj' and vice versa
if (HX_FIELD_EQ(inName,"top") ) { return ::hx::Val( inCallProp == ::hx::paccAlways ? get_top() : top ); }

It almost seems like this shouldn't be allowed

Note: my actual test was a blank flixel project, built via lime test mac -debug - clean

@Simn
Copy link
Member

Simn commented Nov 18, 2024

It looks silly with the explicit type-hint, but I can see legit use cases for this in general. To me this looks like the generated output needs a cast in such cases.

@Simn Simn added the platform-cpp Everything related to CPP / C++ label Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform-cpp Everything related to CPP / C++
Projects
None yet
Development

No branches or pull requests

2 participants