Skip to content

BUG: C++ wrong block length with constant enums #528

Closed
@arobenko

Description

@arobenko

Having the following enum definition

<enum name="Enum1" encodingType="uint8">
    <validValue name="Val1">0</validValue>
    <validValue name="Val2">1</validValue>
    <validValue name="Val3">2</validValue>
</enum> 

and the following message:

<message name="Msg1" id="1" description="TestMessage">
    <field name="field1" id="20" type="Enum1" presence="constant" valueRef="Enum1.Val2"/>
</message>

Generates right constant value for "field1" (which is expected)

Enum1::Value field1() const SBE_NOEXCEPT
{
    return Enum1::Value::Val2;
}

But wrong block length (expected to be 0)

static SBE_CONSTEXPR std::uint16_t sbeBlockLength() SBE_NOEXCEPT
{
    return (std::uint16_t)1;
}

Reproduced with v1.7.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions