[clang] [Clang] Fix -Wunused-variable in #211482 (PR #215134)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Aug 9 12:49:44 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Aiden Grossman (boomanaiden154)
<details>
<summary>Changes</summary>
This is only used in asserts, so fails in a release build without asserts with -Werror -Wunused-variable with the latest clang.
---
Full diff: https://github.com/llvm/llvm-project/pull/215134.diff
1 Files Affected:
- (modified) clang/lib/Sema/SemaExprCXX.cpp (+1-1)
``````````diff
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index 6cc80c8254a78..a76146a8d914f 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -2965,12 +2965,12 @@ ImplicitAllocationArguments::ImplicitAllocationArguments(
PassAlignment(alignedAllocationModeFromBool(AlignArg)),
IsMSVCCompatibilityFallback(IsMSVCCompatibilityFallback),
ArgumentCount(0) {
- ASTContext &Ctx = SemaRef.getASTContext();
if (TypeIdentityArg) {
assert(SemaRef.isStdTypeIdentity(TypeIdentityArg->getType(), nullptr));
ImplicitArguments[ArgumentCount++] = TypeIdentityArg;
}
assert(SizeArg);
+ [[maybe_unused]] ASTContext &Ctx = SemaRef.getASTContext();
assert(Ctx.hasSameType(SizeArg->getType(), Ctx.getSizeType()));
ImplicitArguments[ArgumentCount++] = SizeArg;
if (AlignArg) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/215134
More information about the cfe-commits
mailing list