Skip to content

Commit b5f9bb2

Browse files
committed
Convert default clause assertion into a semantic error
1 parent bafda89 commit b5f9bb2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

flang/lib/Semantics/resolve-directives.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2109,8 +2109,13 @@ void OmpAttributeVisitor::Post(const parser::Name &name) {
21092109
dirContext.defaultDSA == Symbol::Flag::OmpShared) {
21102110
// 1) default
21112111
// Allowed only with parallel, teams and task generating constructs.
2112-
assert(parallelDir || taskGenDir ||
2113-
llvm::omp::allTeamsSet.test(dirContext.directive));
2112+
if (!(parallelDir || taskGenDir ||
2113+
llvm::omp::allTeamsSet.test(dirContext.directive)))
2114+
context_.Say(dirContext.directiveSource,
2115+
"%s directive cannot have default clause"_err_en_US,
2116+
parser::ToUpperCaseLetters(
2117+
llvm::omp::getOpenMPDirectiveName(dirContext.directive)
2118+
.str()));
21142119
if (dirContext.defaultDSA != Symbol::Flag::OmpShared)
21152120
declNewSymbol(dirContext.defaultDSA);
21162121
else

0 commit comments

Comments
 (0)