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

ToStringHelper wrong logic with enum types #56666

Open
wooffie opened this issue Jan 20, 2025 · 0 comments
Open

ToStringHelper wrong logic with enum types #56666

wooffie opened this issue Jan 20, 2025 · 0 comments

Comments

@wooffie
Copy link

wooffie commented Jan 20, 2025

Version

20.18.0

Platform

any

Subsystem

Debug utils (/src/debug_utils-inl.h)

What steps will reproduce the bug?

Use node::toBaseString with enum type.

#include "src/debug_utils-inl.h"

enum SomeEnum : int {
    One, Two, Three
};


int main(){
    std::cout << node::ToBaseString<4>(One) << std::endl;
    std::cout << node::ToBaseString<4>(Two) << std::endl;
}

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior? Why is that the expected behavior?

0
1

What do you see instead?

false
true

Additional information

std::forward<T>(value) has enum type which is not isomorphic with boolean type, however it is used as a boolean expression
Can be fixed with std::is_enum_v<T>

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Reporter: Burkov Egor ([email protected]).

Organization: R-Vision ([email protected]).

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

No branches or pull requests

1 participant