Skip to content

bugprone-narrowing-conversions false positive for contional expression (in C) #139467

Open
@AndreyG

Description

@AndreyG
char test(int cond, char c) {
	char ret = cond > 0 ? ':' : c; // warning: narrowing conversion from 'int' to signed type 'char' is implementation-defined
	return ret;
}

https://godbolt.org/z/6P8Yaqn4o

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions