[SERVER-50101] Allow IDL usage to represent cpp_type of C++ Enum Created: 04/Aug/20  Updated: 08/Jan/24  Resolved: 24/Aug/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Jason Chan Assignee: Backlog - Service Architecture
Resolution: Declined Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-65412 Complete TODO listed in SERVER-50101 Open
related to SERVER-62219 Complete TODO listed in SERVER-50101 Backlog
Assigned Teams:
Service Arch
Participants:

 Description   

For example, I want to define the following:

types:
  fcv_string:
    bson_serialization_type: string
    description: >-
      Ensures that the version strings in featureCompatibilityVersion documents
      serialize/deserialize to a fixed set of string values
    cpp_type: "ServerGlobalParams::FeatureCompatibility::Version"
    serializer: "::mongo::FeatureCompatibilityVersionParser::serializeVersion"
    deserializer: "mongo::FeatureCompatibilityVersionParser::parseVersion"

ServerGlobalParams::FeatureCompatibility::Version is of type C++ enum, which has no default constructor/initialize value. Therefore, IDL ends up generating C++ code that will not compile:

build/opt/mongo/db/commands/set_feature_compatibility_version_gen.cpp:42:50: error: variable 'localCmdType' is uninitialized when used here [-Werror,-Wuninitialized]
    SetFeatureCompatibilityVersionCommand object(localCmdType);
                                                 ^~~~~~~~~~~~
build/opt/mongo/db/commands/set_feature_compatibility_version_gen.cpp:41:5: note: variable 'localCmdType' is declared here
    ServerGlobalParams::FeatureCompatibility::Version localCmdType;
    ^

It would be nice for IDL to support C++ Enum types in this regard.



 Comments   
Comment by Lauren Lewis (Inactive) [ 21/Dec/21 ]

We haven’t heard back from you in at least 1 year, so I'm going to close this ticket. If this is still an issue for you, please provide additional information and we will reopen the ticket.

Generated at Thu Feb 08 05:21:43 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.