diff --git a/src/script_opt/CPP/Compile.h b/src/script_opt/CPP/Compile.h index 16f9312b89..033ed4fa67 100644 --- a/src/script_opt/CPP/Compile.h +++ b/src/script_opt/CPP/Compile.h @@ -186,7 +186,7 @@ public: // Returns a mapping of from Attr objects to their associated // initialization information. The Attr must have previously // been registered. - auto& ProcessedAttr() { return processed_attr; } + auto& ProcessedAttr() const { return processed_attr; } // True if the given expression is simple enough that we can // generate code to evaluate it directly, and don't need to diff --git a/src/script_opt/CPP/InitsInfo.cc b/src/script_opt/CPP/InitsInfo.cc index eab425d658..f02f7f04b2 100644 --- a/src/script_opt/CPP/InitsInfo.cc +++ b/src/script_opt/CPP/InitsInfo.cc @@ -309,7 +309,7 @@ AttrsInfo::AttrsInfo(CPPCompile* _c, const AttributesPtr& _attrs) : CompoundItem for ( const auto& a : _attrs->GetAttrs() ) { ASSERT(c->ProcessedAttr().count(a.get()) > 0); - auto gi = c->ProcessedAttr()[a.get()]; + const auto& gi = c->ProcessedAttr().at(a.get()); init_cohort = max(init_cohort, gi->InitCohort() + 1); vals.emplace_back(Fmt(gi->Offset())); }