Skip to content

-Wcharacter-conversion shouldn't warn about char16_t -> char32_t conversions #163719

@marcmutz

Description

@marcmutz

Clang 21 was released with issue #138526 implementing a warning for the harmless char16_t -> char32_t conversion. This warning is pushing projects that want to use C++ character types for characters back into C++98 mode. While ICU isn't as affected, since they historically use their own typedefs for character types, Qt has just gone through a sweep where we replaced out ushort and uints used as character types with char16_t and char32_t. And this warning is causing reverts: https://codereview.qt-project.org/c/qt/qtbase/+/683817

This warning is therefore actively hurting C++ projects that want to use modern C++. As welcome a char8_t -> char16_t -> char8_t warning would be, the char16_t -> char32_t warning causes the warning to be disabled.

Please also see the comments on issue #138526 for why the conversion is safe.

Metadata

Metadata

Assignees

Labels

clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerrelease:backport

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions