Skip to content

fix universal: fix incorrect initializer-list constructor of AtomicFlags#1201

Open
ddvamp wants to merge 2 commits intouserver-framework:developfrom
ddvamp:userver-patch-flags
Open

fix universal: fix incorrect initializer-list constructor of AtomicFlags#1201
ddvamp wants to merge 2 commits intouserver-framework:developfrom
ddvamp:userver-patch-flags

Conversation

@ddvamp
Copy link
Copy Markdown
Contributor

@ddvamp ddvamp commented Apr 25, 2026

Fixes #1200

@ddvamp
Copy link
Copy Markdown
Contributor Author

ddvamp commented Apr 25, 2026

As far as I can see, this functionality is not being tested at all.

constexpr AtomicFlags()
: AtomicFlags(Enum::kNone)
{}
constexpr explicit AtomicFlags(Flags<Enum>);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add tests , showingand testing the problem

kNone = 0,
kFirst = 1 << 0,
kSecond = 1 << 1,
};
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be better to use

enum class Enum {
    kNone = 0b00,
    kFirst = 0b01,
    kSecond = 0b10
};

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect initializer-list constructor of AtomicFlags

2 participants