================
@@ -7983,14 +7983,23 @@ CastKind Sema::PrepareScalarCast(ExprResult &Src,
QualType DestTy) {
if (Context.hasSameUnqualifiedType(SrcTy, DestTy))
return CK_NoOp;
+ // C23 6.7.3.3p16: conversion to an enumerated type with a fixed underlying
+ // type has the same semantics as conversion to the underlying type, so an
+ // enumeration with an underlying type of bool converts like bool.
+ Type::ScalarTypeKind DestKind = DestTy->getScalarTypeKind();
----------------
mohitmishra786 wrote:
Done in af5100f19. getScalarTypeKind() now returns STK_Bool for an enum with a
fixed underlying type of bool. The other callers already treat STK_Bool like
STK_Integral; the only visible difference is that `!e` in C++ now gets a NoOp
cast to bool instead of IntegralToBoolean.
https://github.com/llvm/llvm-project/pull/244494
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits