Index: src/Common/Iterate.hpp
===================================================================
--- src/Common/Iterate.hpp	(revision 1ccae596fbc273132237cb1a0ddfa6a7f7afdd5c)
+++ src/Common/Iterate.hpp	(revision 45a091b00fd95491b28961bb07e3975caedbe601)
@@ -58,6 +58,6 @@
 	template<typename val_t>
 	struct value_t {
+		size_t idx;
 		val_t & val;
-		size_t idx;
 	};
 
@@ -69,5 +69,5 @@
 		iterator_t( iter_t _it, size_t _idx ) : it(_it), idx(_idx) {}
 
-		value_t<val_t> operator*() const { return value_t<val_t>{ *it, idx }; }
+		value_t<val_t> operator*() const { return value_t<val_t>{ idx, *it }; }
 
 		bool operator==(const iterator_t & o) const { return o.it == it; }
Index: src/Concurrency/WaitforNew.cpp
===================================================================
--- src/Concurrency/WaitforNew.cpp	(revision 1ccae596fbc273132237cb1a0ddfa6a7f7afdd5c)
+++ src/Concurrency/WaitforNew.cpp	(revision 45a091b00fd95491b28961bb07e3975caedbe601)
@@ -450,6 +450,5 @@
 	);
 
-	// For some reason, enumerate doesn't work here because of references.
-	for ( size_t i = 0 ; i < waitfor->clauses.size() ; ++i ) {
+	for ( const auto & [i, clause] : enumerate( waitfor->clauses ) ) {
 		theSwitch->cases.push_back(
 			new ast::CaseClause( location,
@@ -457,5 +456,5 @@
 				{
 					new ast::CompoundStmt( location, {
-						waitfor->clauses[i]->stmt,
+						clause->stmt,
 						new ast::BranchStmt( location,
 							ast::BranchStmt::Break,
@@ -538,7 +537,6 @@
 	ast::Stmt       * setter      = makeSetter( location, flag );
 
-	// For some reason, enumerate doesn't work here because of references.
-	for ( size_t i = 0 ; i < stmt->clauses.size() ; ++i ) {
-		init_clause( comp, acceptables, i, stmt->clauses[i], setter );
+	for ( const auto & [i, clause] : enumerate( stmt->clauses ) ) {
+		init_clause( comp, acceptables, i, clause, setter );
 	}
 
