https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/219897
The previous version of `y()` used `c2[i]`, which can't be evaluated at compile-time. The emitted diagnostic depends on something calling `ASTContext::getASTRecordLayout()` for `b`, which currently happens in the constant evaluator. If the evaluator decides to evaluate `c2[i]` before calling `getASTRecordLayout()`, the test fails since the diagnostic is never emitted. Fix this by simply using `c2[0]` instead. >From 60f59b0f99ade9ee9cfea3a74e830a3eea039b95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= <[email protected]> Date: Mon, 31 Aug 2026 09:08:50 +0200 Subject: [PATCH] [clang][test] Make new absurdly_big_struct test more targeted The previous version of `y()` used `c2[i]`, which can't be evaluated at compile-time. The emitted diagnostic depends on something calling `ASTContext::getASTRecordLayout()` for `b`, which currently happens in the constant evaluator. If the evaluator decides to evaluate `c2[i]` before calling `getASTRecordLayout()`, the test fails since the diagnostic is never emitted. Fix this by simply using `c2[0]` instead. --- clang/test/AST/absurdly_big_struct.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/test/AST/absurdly_big_struct.cpp b/clang/test/AST/absurdly_big_struct.cpp index 69e191aaf70fa..de44de2754727 100644 --- a/clang/test/AST/absurdly_big_struct.cpp +++ b/clang/test/AST/absurdly_big_struct.cpp @@ -20,5 +20,5 @@ struct b { // bit32-error {{structure 'b' is too large, which exceeds maximum al char c2[2]; }; -long long y(int i) { return __builtin_offsetof(b, c2[i]); } +long long y() { return __builtin_offsetof(b, c2[0]); } _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
