diff --git a/flang/lib/Semantics/check-omp-structure.cpp b/flang/lib/Semantics/check-omp-structure.cpp --- a/flang/lib/Semantics/check-omp-structure.cpp +++ b/flang/lib/Semantics/check-omp-structure.cpp @@ -666,8 +666,10 @@ PushContext(dir.source, OmpDirective::BARRIER); } break; case parser::OmpSimpleStandaloneDirective::Directive::Taskwait: { - // 2.13.4 taskwait + // 2.17.5 taskwait [OpenMP 5.0] PushContext(dir.source, OmpDirective::TASKWAIT); + OmpClauseSet allowed{OmpClause::DEPEND}; + SetContextAllowed(allowed); } break; case parser::OmpSimpleStandaloneDirective::Directive::Taskyield: { // 2.9.4 taskyield diff --git a/flang/test/Semantics/omp-clause-validity01.f90 b/flang/test/Semantics/omp-clause-validity01.f90 --- a/flang/test/Semantics/omp-clause-validity01.f90 +++ b/flang/test/Semantics/omp-clause-validity01.f90 @@ -396,6 +396,9 @@ !$omp taskyield !$omp barrier !$omp taskwait + !$omp taskwait depend(source) + !ERROR: Internal: no symbol found for 'i' + !$omp taskwait depend(sink:i-1) ! !$omp target enter data map(to:arrayA) map(alloc:arrayB) ! !$omp target update from(arrayA) to(arrayB) ! !$omp target exit data map(from:arrayA) map(delete:arrayB)