Skip to content

wcschr omits wchar_t from the errors #146470

@Alcaro

Description

@Alcaro
#include <wchar.h>

void the_bug()
{
    (void)wcschr(123, 0);
    (void)wcsrchr(123, 0);
    (void)wcsstr(123, 0);
}

C only; the bug does not reproduce in C++, where wchar_t is a keyword. Only specifically wcschr is affected, not even wcsrchr which has identical prototype.

Expected:

<source>:5:18: error: [...] parameter of type 'const wchar_t *' (aka 'const int *') [-Wint-conversion]
<source>:6:19: error: [...] parameter of type 'const wchar_t *' (aka 'const int *') [-Wint-conversion]
<source>:7:18: error: [...] parameter of type 'const wchar_t *' (aka 'const int *') [-Wint-conversion]

Actual:

<source>:5:18: error: [...] parameter of type 'const int *' [-Wint-conversion]
<source>:6:19: error: [...] parameter of type 'const wchar_t *' (aka 'const int *') [-Wint-conversion]
<source>:7:18: error: [...] parameter of type 'const wchar_t *' (aka 'const int *') [-Wint-conversion]

https://godbolt.org/z/sdMhhv3d3

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerconfirmedVerified by a second party

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions