[clang] [Clang][Sema] Error message refers to `__begin1` with `constexpr` variable in range-based for loop (PR #218145)
Akash Manna via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 26 10:54:47 PDT 2026
================
@@ -1943,6 +1943,10 @@ namespace InitializerList {
constexpr std::initializer_list<float> il = {1.0, 2.0, 3.0};
static_assert(il.begin()[1] == 2.0, "");
}
+
+ void constexpr_loop_var() {
+ for (constexpr auto x : {1, 2, 3}) {} // expected-error {{constexpr variable 'x' must be initialized by a constant expression}} expected-note {{iterator of the range-based for loop is not a constant expression}}
+ }
----------------
akash-manna-sky wrote:
I added, right below.
https://github.com/llvm/llvm-project/pull/218145
More information about the cfe-commits
mailing list