[clang] [clang] Add regression test for issue 111378 (PR #224605)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 18 04:28:32 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: MishkaSimakov
<details>
<summary>Changes</summary>
Added a regression test for https://github.com/llvm/llvm-project/issues/111378 in `SemaCXX/constant-expression-cxx11.cpp`.
The bug itself was fixed in the commit `dc28f9d087324f77db81e7192648a17ebf036125` which addressed a different issue.
Verified that the test passes now, and that it fails on commit `eebb50afaf27961b21847950179febdd20a98866` (previous to the bug fix commit).
Also verified that the test fails when removing the fix from the current version of the code.
---
Full diff: https://github.com/llvm/llvm-project/pull/224605.diff
1 Files Affected:
- (modified) clang/test/SemaCXX/constant-expression-cxx11.cpp (+8)
``````````diff
diff --git a/clang/test/SemaCXX/constant-expression-cxx11.cpp b/clang/test/SemaCXX/constant-expression-cxx11.cpp
index 7b483a4238652..6e41bb98f1805 100644
--- a/clang/test/SemaCXX/constant-expression-cxx11.cpp
+++ b/clang/test/SemaCXX/constant-expression-cxx11.cpp
@@ -2747,3 +2747,11 @@ namespace GH154567 {
constexpr S s{};
static_assert(s.val.i == 0, "");
}
+
+namespace GH111378 {
+ void f() {
+ int &b = 0;
+ // expected-error at -1 {{non-const lvalue reference to type 'int' cannot bind to a temporary of type 'int'}}
+ auto &&L = [&]() { return b; };
+ }
+}
``````````
</details>
https://github.com/llvm/llvm-project/pull/224605
More information about the cfe-commits
mailing list