NordicSemiconductor / zcbor

Low footprint C/C++ CBOR library and Python tool providing code generation from CDDL descriptions.
Apache License 2.0
105 stars 34 forks source link

Error generating code from CDDL with optional array #428

Open aangert opened 1 month ago

aangert commented 1 month ago

When generating Code with zcbor code -c pet.cddl -d -e -t Pet --output-cmake ~/generated/pet the optional element error causes the Error

AssertionError: Must be a direct call to zcbor to guarantee that payload and elem_count"
are cleaned up after a failure.

If error is not optional code is generated sucessfully, and other elements can be marked as optional without throwing an error. pet.cddl:

Pet = [
    name: [ +tstr ],
    ?error: arr,
]

arr = [
    dummy: uint,
]
oyvindronningstad commented 1 month ago

Thanks for the report, this will be fixed.