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

[cpp] package called hx fails to compile when scriptable is defined #11831

Open
Aidan63 opened this issue Nov 20, 2024 · 0 comments
Open

[cpp] package called hx fails to compile when scriptable is defined #11831

Aidan63 opened this issue Nov 20, 2024 · 0 comments

Comments

@Aidan63
Copy link
Contributor

Aidan63 commented Nov 20, 2024

As the title says, if you have a package named hx it will fail to compile when scriptable is defined, but only if the hx package is not root.

package foo.hx;

class Foo {
    public function new() {}
}
import foo.hx.Foo;

function main() {
    trace(new Foo());
}

The above results in the following errors on 4.3.x and nightlies (just a small snippet since there is a lot...)

Error: Foo.cpp
./src/foo/hx/Foo.cpp(46): error C2039: 'Object': is not a member of 'foo::hx'
./src/foo/hx/Foo.cpp(11): note: see declaration of 'foo::hx'
./src/foo/hx/Foo.cpp(46): error C2039: 'Class': is not a member of 'foo::hx'
./src/foo/hx/Foo.cpp(11): note: see declaration of 'foo::hx'
./src/foo/hx/Foo.cpp(46): error C3646: '__GetClass': unknown override specifier
./src/foo/hx/Foo.cpp(46): error C2059: syntax error: '('
./src/foo/hx/Foo.cpp(46): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
./src/foo/hx/Foo.cpp(46): error C2039: 'MarkContext': is not a member of 'foo::hx'
./src/foo/hx/Foo.cpp(11): note: see declaration of 'foo::hx'
./src/foo/hx/Foo.cpp(46): error C2061: syntax error: identifier 'MarkContext'
./src/foo/hx/Foo.cpp(46): error C2039: 'VisitContext': is not a member of 'foo::hx'
./src/foo/hx/Foo.cpp(11): note: see declaration of 'foo::hx'
./src/foo/hx/Foo.cpp(46): error C2061: syntax error: identifier 'VisitContext'
./src/foo/hx/Foo.cpp(47): error C2039: 'Val': is not a member of 'foo::hx'
./src/foo/hx/Foo.cpp(11): note: see declaration of 'foo::hx'
./src/foo/hx/Foo.cpp(47): error C3646: '__Field': unknown override specifier
./src/foo/hx/Foo.cpp(47): error C2059: syntax error: '('

Issue seems to be that some of the C++ cppia macros aren't prefixing hx namespaces with :: so its relatively looking into our non root hx namespace, not the root hx namespace which hxcpp defines a lot of stuff in.

I can think of two possible fixes, add "hx" to the list of reserved keywords in gencpp so it gets remapped, or update the hxcpp macros so :: is prefixed. Maybe both?

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