[PATCH] D123009: [Sema] Enum conversion warning when one signed and other unsigned.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 3 08:29:07 PDT 2022


aaron.ballman added a comment.

Thanks for the updates! I think this is getting somewhat close, but I'd like to see some additional test cases to ensure we're not regressing behavior we care about (I think we may be losing warnings about sign conversion).

  // Signed enums
  enum SE1 { N1 = -1 };
  enum SE2 { N2 = -2 };
  // Unsigned unums
  enum UE1 { P1 };
  enum UE2 { P2 };
  
  int f1(enum UE1 E) {
    return E; // warning about sign conversion
  }
  
  int f2(enum UE1 E) {
    return E; // warning about sign conversion
  }
  
  int f3(enum SE1 E) {
    return E; // shouldn't warn
  }
  
  int f4(enum SE1 E) {
    return E; // shouldn't warn
  }


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123009/new/

https://reviews.llvm.org/D123009



More information about the cfe-commits mailing list