@@ -1470,7 +1470,6 @@ class OmpVisitor : public virtual DeclarationVisitor {
14701470 }
14711471
14721472 bool Pre (const parser::OpenMPDeclareMapperConstruct &);
1473- void Post (const parser::OpenMPDeclareMapperConstruct &) { PopScope (); };
14741473
14751474 void Post (const parser::OmpBeginLoopDirective &) {
14761475 messageHandler ().set_currStmtSource (std::nullopt );
@@ -1609,10 +1608,10 @@ void OmpVisitor::Post(const parser::OpenMPBlockConstruct &x) {
16091608 }
16101609}
16111610
1612- // This "manually" walks the tree of the cosntruct , because the order
1613- // elements are resolved by the normal visitor will try to resolve
1614- // the map clauses attached to the directive without having resolved
1615- // the type, so the type is figured out using the implicit rules .
1611+ // This "manually" walks the tree of the construct , because we need
1612+ // to resolve the type before the map clauses are processed - when
1613+ // just following the natural flow, the map clauses gets processed before
1614+ // the type has been fully processed .
16161615bool OmpVisitor::Pre (const parser::OpenMPDeclareMapperConstruct &x) {
16171616 AddOmpSourceRange (x.source );
16181617 BeginDeclTypeSpec ();
@@ -1623,8 +1622,9 @@ bool OmpVisitor::Pre(const parser::OpenMPDeclareMapperConstruct &x) {
16231622 &MakeSymbol (*mapperName, MiscDetails{MiscDetails::Kind::ConstructName});
16241623 mapperName->symbol = mapperSym;
16251624 } else {
1625+ const parser::CharBlock defaultName{" default" , 7 };
16261626 mapperSym = &MakeSymbol (
1627- " default " , Attrs{}, MiscDetails{MiscDetails::Kind::ConstructName});
1627+ defaultName , Attrs{}, MiscDetails{MiscDetails::Kind::ConstructName});
16281628 }
16291629
16301630 PushScope (Scope::Kind::OtherConstruct, nullptr );
@@ -1635,6 +1635,7 @@ bool OmpVisitor::Pre(const parser::OpenMPDeclareMapperConstruct &x) {
16351635 Walk (std::get<parser::OmpClauseList>(x.t ));
16361636
16371637 EndDeclTypeSpec ();
1638+ PopScope ();
16381639 return false ;
16391640}
16401641
0 commit comments