[flang-commits] [flang] [flang][OpenMP] Improve diagnosing invalid operators in DECLARE_REDUCTION (PR #232353)

via flang-commits flang-commits at lists.llvm.org
Fri Oct 23 12:50:38 PDT 2026


================
@@ -771,8 +771,26 @@ void OmpStructureChecker::Enter(const parser::OmpMetadirectiveDirective &x) {
   EnterDirectiveNest(MetadirectiveNest);
 }
 
-void OmpStructureChecker::Leave(const parser::OmpMetadirectiveDirective &) {
-  ExitDirectiveNest(MetadirectiveNest);
+void OmpStructureChecker::Leave(const parser::OmpMetadirectiveDirective &x) {
+  // Perform semantic checks on declarative variants on this METADIRECTIVE.
+  if (!partStack_.empty() && partStack_.back() == PartKind::SpecificationPart) {
----------------
MattPD wrote:

I confirmed that Flang also accepts the `/` example with `otherwise(error at(compilation))` under `-fsyntax-only` at [af3e8691](https://github.com/llvm/llvm-project/commit/af3e869180226b620d54047fd0b0f4aa460375c0). Could Flang retain the invalid-operator diagnostic while mixed variants remain unsupported?

https://github.com/llvm/llvm-project/pull/232353


More information about the flang-commits mailing list