[all-commits] [llvm/llvm-project] df267d: [C] Add new -Wimplicit-int-enum-cast to -Wc++-comp...

Aaron Ballman via All-commits all-commits at lists.llvm.org
Tue Apr 29 04:06:30 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: df267d77f6cc06608d2fabc2139cabbd99007381
      https://github.com/llvm/llvm-project/commit/df267d77f6cc06608d2fabc2139cabbd99007381
  Author: Aaron Ballman <aaron at aaronballman.com>
  Date:   2025-04-29 (Tue, 29 Apr 2025)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/DiagnosticGroups.td
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/Sema/SemaChecking.cpp
    M clang/test/Misc/warning-flags-enabled.c
    A clang/test/Sema/implicit-int-enum-conversion.c

  Log Message:
  -----------
  [C] Add new -Wimplicit-int-enum-cast to -Wc++-compat (#137658)

This introduces a new diagnostic group to diagnose implicit casts from
int to an enumeration type. In C, this is valid, but it is not
compatible with C++.

Additionally, this moves the "implicit conversion from enum type to
different enum type" diagnostic from `-Wenum-conversion` to a new group
`-Wimplicit-enum-enum-cast`, which is a more accurate home for it.
`-Wimplicit-enum-enum-cast` is also under `-Wimplicit-int-enum-cast`, as
it is the same incompatibility (the enumeration on the right-hand is
promoted to `int`, so it's an int -> enum conversion).

Fixes #37027



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list