diff --git a/flang/lib/Semantics/resolve-directives.cpp b/flang/lib/Semantics/resolve-directives.cpp --- a/flang/lib/Semantics/resolve-directives.cpp +++ b/flang/lib/Semantics/resolve-directives.cpp @@ -1482,7 +1482,8 @@ if (Symbol * found{currScope().FindSymbol(name.source)}) { if (symbol != found) { name.symbol = found; // adjust the symbol within region - } else if (GetContext().defaultDSA == Symbol::Flag::OmpNone) { + } else if (GetContext().defaultDSA == Symbol::Flag::OmpNone && + !IsNamedConstant(*symbol)) { context_.Say(name.source, "The DEFAULT(NONE) clause requires that '%s' must be listed in " "a data-sharing attribute clause"_err_en_US, diff --git a/flang/test/Semantics/OpenMP/omp-resolve05.f90 b/flang/test/Semantics/OpenMP/omp-resolve05.f90 --- a/flang/test/Semantics/OpenMP/omp-resolve05.f90 +++ b/flang/test/Semantics/OpenMP/omp-resolve05.f90 @@ -5,7 +5,7 @@ subroutine default_none() integer a(3) - + integer, parameter :: D=10 A = 1 B = 2 !$omp parallel default(none) private(c) @@ -13,7 +13,7 @@ A(1:2) = 3 !ERROR: The DEFAULT(NONE) clause requires that 'b' must be listed in a data-sharing attribute clause B = 4 - C = 5 + C = 5 + D !$omp end parallel end subroutine default_none