Skip to content

Incorrect warning about wchar_t in C #155988

@AaronBallman

Description

@AaronBallman

Should this warn about wchar_t in C?

#include <wchar.h>

int main (void)
{
  wchar_t foo;
  (void)foo;
  return 0;
}
% xcrun /Users/builder/llvm/llvm-install/bin/clang -fsyntax-only -Weverything ~/Desktop/test.c

/Users/builder/Desktop/test.c:5:3: warning: identifier 'wchar_t' conflicts with a C++ keyword [-Wc++-keyword]
    5 |   wchar_t foo;
      |   ^

Originally posted by @seanm in #137234 (comment)

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