[SERVER-55257] IDL generates non-compiling comparison operations with inline_chained_structs:true Created: 17/Mar/21  Updated: 06/Dec/22

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

Type: Bug Priority: Major - P3
Reporter: Max Hirschhorn Assignee: Backlog - Service Architecture
Resolution: Unresolved Votes: 0
Labels: sa-remove-fv-backlog-22
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-31705 IDL should automatically create == an... Closed
Assigned Teams:
Service Arch
Operating System: ALL
Participants:
Story Points: 4

 Description   

It appears that specifying {inline_chained_structs: true} leads the generated comparison operators to attempt to directly compare the member variables which exist on the chained struct despite them being on a different type.

structs:
    One:
        description: ""
        generate_comparison_operators: true
        fields:
            one: int
 
    Two:
        description: ""
        inline_chained_structs: true
        chained_structs:
            One: OneStruct
        generate_comparison_operators: true
        fields:
            two: int

class Two {
public:
...
    friend bool operator==(const Two& left, const Two& right) {
        return left._oneStruct == right._oneStruct && left._one == right._one && left._two == right._two;
    }
...
private:
    mongo::One _oneStruct;
    std::int32_t _two;
    bool _hasTwo : 1;
};


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