[clang] [Sema] Remove an unnecessary cast (NFC) (PR #147154)

via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 5 09:45:53 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>

BitWidth is already of Expr *.


---
Full diff: https://github.com/llvm/llvm-project/pull/147154.diff


1 Files Affected:

- (modified) clang/lib/Sema/SemaDecl.cpp (+1-2) 


``````````diff
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index d0e9bef58ddee..11cbda412667f 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -18636,8 +18636,7 @@ ExprResult Sema::VerifyBitField(SourceLocation FieldLoc,
         << FieldName << FieldTy << BitWidth->getSourceRange();
     return Diag(FieldLoc, diag::err_not_integral_type_anon_bitfield)
       << FieldTy << BitWidth->getSourceRange();
-  } else if (DiagnoseUnexpandedParameterPack(const_cast<Expr *>(BitWidth),
-                                             UPPC_BitFieldWidth))
+  } else if (DiagnoseUnexpandedParameterPack(BitWidth, UPPC_BitFieldWidth))
     return ExprError();
 
   // If the bit-width is type- or value-dependent, don't try to check

``````````

</details>


https://github.com/llvm/llvm-project/pull/147154


More information about the cfe-commits mailing list