https://github.com/boomanaiden154 created 
https://github.com/llvm/llvm-project/pull/215134

This is only used in asserts, so fails in a release build without asserts with 
-Werror -Wunused-variable with the latest clang.

>From 3dfe08af373d90599951b5415ae272ce35e264e0 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <[email protected]>
Date: Sun, 9 Aug 2026 19:44:13 +0000
Subject: [PATCH] [Clang] Fix -Wunused-variable in #211482

This is only used in asserts, so fails in a release build without
asserts with -Werror -Wunused-variable with the latest clang.
---
 clang/lib/Sema/SemaExprCXX.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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) {

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to