Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Illegal IDL union accepted by tao_idl #2279

Open
jwillemsen opened this issue Aug 26, 2024 · 5 comments
Open

Illegal IDL union accepted by tao_idl #2279

jwillemsen opened this issue Aug 26, 2024 · 5 comments

Comments

@jwillemsen
Copy link
Member

The following IDL is illegal but accepted by tao_idl, ridlc rejects it with IDL::ParseError: 'default' case label superfluous for IDL::AST::Union UnionTypeTest

module Test {
enum TypeKind {
STRING_TYPE,
LONG_TYPE,
FLOAT_TYPE
};

union UnionTypeTest switch(TypeKind) {
case STRING_TYPE:
    string string_data;
case LONG_TYPE:
    long long_data;
case FLOAT_TYPE:
    float float_data;
default:
    boolean default_data;
};

};
@jwillemsen
Copy link
Member Author

Coming from OpenDDS/OpenDDS#4782

@iguessthislldo
Copy link
Member

It's a weird case, but I'm not seeing something in the IDL spec that explicitly disallows this.

@mitza-oci
Copy link
Member

It's a weird case, but I'm not seeing something in the IDL spec that explicitly disallows this.

It was in IDL v3 https://www.omg.org/spec/CORBA/3.3/Interfaces/PDF, I'm not sure why IDL v4 dropped it

@iguessthislldo
Copy link
Member

A union type can contain a default label only where the values given in the non-default labels do not cover the entire range of the union's discriminant type.

This? I see it in 4.2 now, it moved into the bottom of the first "Note" in the union section. Alright, so it does explicitly disallow this, assuming "range" is all the valid enum values and not just the underlying integer type.

@mitza-oci
Copy link
Member

Right, so I guess I just didn't find it in 4.2. The union discriminator is defined by the enum type, not the underlying type.

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

No branches or pull requests

3 participants