Skip to content

Conversation

@thomz12
Copy link

@thomz12 thomz12 commented Jun 15, 2023

native_type generated C++ code that couldn't be compiled when used without native_inline.

Related to issue #6770, which never got fixed.

Before, a schema like this would generate code that couldn't be compiled:

native_include "native_type_test_impl.h";

namespace Geometry;

struct Vector3D (native_type:"Native::Vector3D") {
  x:float;
  y:float;
  z:float;
}

table ApplicationData {
  position:Vector3D;
}

root_type ApplicationData;

Using the Vector3D as an array or with the "native_inline" attribute did work as expected.
I've added some code to the C++ generator to fix the issue so it works by itself. It has to create a unique_ptr correctly when unpacking and de-referencing one when packing.

I also added some test cases for the native_type, one with the native_inline attribute and one without to NativeTypeTest.

native_type generated C++ code that couldn't be compiled when used without native_inline.
@github-actions github-actions bot added c++ codegen Involving generating code from schema labels Jun 15, 2023
Removed use of make_unique. I had to get rid of some define that defined 'new' to 'DEBUG_NEW' in one test. I think this might not be in use anymore?
@github-actions
Copy link
Contributor

github-actions bot commented Jul 6, 2023

This pull request is stale because it has been open 3 weeks with no activity. Please comment or label not-stale, or this will be closed in 7 days.

@github-actions github-actions bot added the stale label Jul 6, 2023
@github-actions
Copy link
Contributor

This pull request was automatically closed due to no activity for 6 months plus the 14 day notice period.

@github-actions github-actions bot closed this Jul 20, 2023
@sethraymond
Copy link
Contributor

Bump, this is still an issue and this PR should get merged.

@pkaff
Copy link

pkaff commented Nov 20, 2024

Agree, also having this issue. @thomz12 could you re-open the PR and try to get some visibility and reviewers on it? Cheers!

@souryavarenya
Copy link
Contributor

Yes, indeed.

@aardappel
Copy link
Collaborator

Please reopen a PR with this change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ codegen Involving generating code from schema stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants