[clang] [Clang][Sema] Error message refers to `__begin1` with `constexpr` variable in range-based for loop (PR #218145)

Mariya Podchishchaeva via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 24 02:53:09 PDT 2026


================
@@ -15056,6 +15056,23 @@ void Sema::addLifetimeBoundToImplicitThis(CXXMethodDecl *MD) {
   MD->setTypeSourceInfo(TLB.getTypeSourceInfo(Context, AttributedType));
 }
 
+/// Determine whether the initializer of a range-based for loop variable reads
+/// one of the loop's implicit non-constexpr iterator variables ('__begin1').
+static bool initReadsForRangeImplicitVar(const Expr *Init) {
----------------
Fznamznon wrote:

I don't think this is how you should do this. A constexpr evaluator should emit a specific note when it encounters the variable.

https://github.com/llvm/llvm-project/pull/218145


More information about the cfe-commits mailing list