================
@@ -501,3 +501,11 @@ namespace SubPtr {
// both-note {{subtracted
pointers are not elements of the same array}}
constexpr auto diff8 = &a[1][2].n - (&a[1][2].n + 1);
}
+
+namespace ConstexprForRangeVar {
+ void f() {
+ int arr[] = {1, 2, 3};
+ for (constexpr int a : arr) {} // both-error {{constexpr variable 'a' must
be initialized by a constant expression}} \
+ // both-note {{range-based for loop
variable is initialized on each iteration from the loop's iterator, whose value
is not known at compile time}}
----------------
akash-manna-sky wrote:
dropped that framing; the note now names the begin variable instead.
https://github.com/llvm/llvm-project/pull/218145
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits