eclipse-cyclonedds / cyclonedds

Eclipse Cyclone DDS project
https://projects.eclipse.org/projects/iot.cyclonedds
Other
889 stars 363 forks source link

Issue using Union with empty struct #2091

Closed jc211 closed 2 months ago

jc211 commented 2 months ago
enum someenum
{
    A,
    B,
    C
};

@final
struct APayload {
    string dummy1;
    string dummy2;
};

@final 
struct NoPayload {
};

@final
union Foo switch(someenum) {
    case A:
        APayload a_payload;
    case B:
    case C:
        NoPayload empty_payload;
};

The above produces BAD PARAMTER error when used in a topic.

dpotman commented 2 months ago

Thanks for reporting! The type meta-data validator was rejecting empty structs. I've created a pull request that fixes the issue.