https://github.com/amanmaurya92 created
https://github.com/llvm/llvm-project/pull/224389
### Summary
Fixes CI test failures introduced in #219288:
- In `clang/test/AST/ByteCode/records.cpp`, resolves the existing `FIXME: See
#85601` by updating `static_assert(discarded() == 1)` to
`static_assert(discarded() == 0)` now that temporary destruction timing in
aggregate default member initialization is fixed.
- In `clang/test/SemaCXX/aggregate-default-member-initializers.cpp`, removes
outdated `bytecode-error` and `bytecode-note` annotations in the `lifetime`
namespace that caused `-verify` failures ("diagnostics expected but not seen")
under `-fexperimental-new-constant-interpreter`.
Fixes build breakages on `main` affecting pre-merge CI across subsequent PRs.
Cc: @yronglin
>From 81ef6814ff9d78755fc62e9791b8cd9ebe8bdbae Mon Sep 17 00:00:00 2001
From: amanmaurya92 <[email protected]>
Date: Fri, 18 Sep 2026 00:59:48 +0530
Subject: [PATCH] [clang][test] Update ByteCode test expectations after #219288
PR #219288 fixed #85601 by ensuring temporaries in aggregate default member
initializers are destroyed at the end of the enclosing full-expression.
Update test expectations for the new constant interpreter:
1. clang/test/AST/ByteCode/records.cpp: Update static_assert(discarded() == 1)
to static_assert(discarded() == 0), resolving the FIXME for #85601.
2. clang/test/SemaCXX/aggregate-default-member-initializers.cpp: Remove
outdated bytecode-error and bytecode-note expectations in namespace lifetime,
as the bytecode interpreter now successfully evaluates them.
---
clang/test/AST/ByteCode/records.cpp | 10 ++++------
.../aggregate-default-member-initializers.cpp | 14 ++++----------
2 files changed, 8 insertions(+), 16 deletions(-)
diff --git a/clang/test/AST/ByteCode/records.cpp
b/clang/test/AST/ByteCode/records.cpp
index daba582f82fb5..39d2b948ee59f 100644
--- a/clang/test/AST/ByteCode/records.cpp
+++ b/clang/test/AST/ByteCode/records.cpp
@@ -1315,12 +1315,10 @@ namespace {
return x;
}
- /// Before the result object was allocated, this could not be evaluated at
- /// all. The temporary 'B' is not destroyed until the end of the enclosing
- /// full-expression, so 'x' still reads 1 here, matching legacy evaluator.
- ///
- /// FIXME: See https://github.com/llvm/llvm-project/issues/85601.
- static_assert(discarded() == 1);
+ /// The temporary 'A' created by the default member initializer is destroyed
+ /// at the end of the full-expression containing the aggregate initialization
+ /// (see https://github.com/llvm/llvm-project/issues/85601).
+ static_assert(discarded() == 0);
/// A const-qualified composite result is writable while under construction.
constexpr int decrement(int &x) {
diff --git a/clang/test/SemaCXX/aggregate-default-member-initializers.cpp
b/clang/test/SemaCXX/aggregate-default-member-initializers.cpp
index 9a004ea79d84a..27fb4deab77d6 100644
--- a/clang/test/SemaCXX/aggregate-default-member-initializers.cpp
+++ b/clang/test/SemaCXX/aggregate-default-member-initializers.cpp
@@ -17,10 +17,7 @@ struct AA {
struct B {
int &x;
- // FIXME: The new constant interpreter does not give a discarded composite
- // prvalue a result object, so the default member initializer cannot read
- // 'x'. This predates this change; the legacy interpreter gets it right.
- const A &a = A{x}; // bytecode-note 3{{implicit use of 'this' pointer is
only allowed within the evaluation of a call to a 'constexpr' member function}}
+ const A &a = A{x};
};
struct BB {
@@ -46,12 +43,9 @@ constexpr int paren() {
return x;
}
-static_assert(one() == 0); // bytecode-error {{static assertion expression is
not an integral constant expression}} \
- // bytecode-note {{in call to 'one()'}}
-static_assert(two() == 0); // bytecode-error {{static assertion expression is
not an integral constant expression}} \
- // bytecode-note {{in call to 'two()'}}
-static_assert(paren() == 0); // bytecode-error {{static assertion expression
is not an integral constant expression}} \
- // bytecode-note {{in call to 'paren()'}}
+static_assert(one() == 0);
+static_assert(two() == 0);
+static_assert(paren() == 0);
} // namespace lifetime
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits