NordicSemiconductor / zcbor

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

Error generating code from CDDL with optional array #428

Closed aangert closed 3 months ago

aangert commented 6 months 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 6 months ago

Thanks for the report, this will be fixed.