forked from jmckaskill/c-capnproto
-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Description
Hi ,
I was trying to use the plugin and I encountered what I think is a bug, please let me know if my understanding is wrong about how the generated API works.
The schema definitions that I used is the following:
struct Leaf{
value @0 : Int32;
}
struct Inner {
left @0 :TreeNode;
right @1 : TreeNode;
}
struct TreeNode {
nodeType @0 :Int32;
leaf @1 : Leaf;
inner @2 :Inner;
}For the following code I expect 1 to be printed but 0 is printed instead ;It looks like there is something wrong in the method Tree_Node_set_leaf(...) unless I misunderstand how it should work!
struct capn c;
struct capn_segment *cs;
capn_ptr cr;
capn_init_malloc(&c);
cr = capn_root(&c);
cs = cr.seg;
TreeNode_ptr n = new_TreeNode(cs);
TreeNode_set_nodeType(n, 1);
Leaf_ptr l = new_Leaf(cs);
Leaf_set_value(l , 1);
TreeNode_set_leaf(n, l);
cout<<Leaf_get_value(TreeNode_get_leaf(n))<<endl;Metadata
Metadata
Assignees
Labels
No labels