@@ -164,11 +164,8 @@ void RewriteMutator::OpenMPSimdOnly(parser::SpecificationPart &specPart) {
164164// loop.
165165void RewriteMutator::OpenMPSimdOnly (
166166 parser::Block &block, bool isNonSimdLoopBody = false ) {
167- using ExecutionListIterator =
168- std::_List_iterator<parser::ExecutionPartConstruct>;
169167 auto replaceInlineBlock =
170- [&](std::list<parser::ExecutionPartConstruct> &block,
171- ExecutionListIterator it) -> ExecutionListIterator {
168+ [&](std::list<parser::ExecutionPartConstruct> &block, auto it) -> auto {
172169 auto insertPos = std::next (it);
173170 block.splice (insertPos, block);
174171 block.erase (it);
@@ -410,9 +407,11 @@ bool RewriteMutator::Pre(parser::OpenMPLoopConstruct &ompLoop) {
410407 // call OpenMPSimdOnly on the nested loop block while indicating where
411408 // the block comes from.
412409 auto &nest = std::get<std::optional<parser::NestedConstruct>>(ompLoop.t );
413- if (nest.has_value ()) {
414- auto &doConstruct = std::get<parser::DoConstruct>(nest.value ());
415- auto &innerBlock = std::get<parser::Block>(doConstruct.t );
410+ if (!nest.has_value ()) {
411+ return true ;
412+ }
413+ if (auto *doConstruct = std::get_if<parser::DoConstruct>(&*nest)) {
414+ auto &innerBlock = std::get<parser::Block>(doConstruct->t );
416415 OpenMPSimdOnly (innerBlock, /* isNonSimdLoopBody=*/ true );
417416 }
418417 }
0 commit comments