[flang-commits] [flang] [flang] Improve error for misplaced statement after CONTAINS in derived type (PR #215886)

via flang-commits flang-commits at lists.llvm.org
Thu Aug 13 14:52:31 PDT 2026


================
@@ -228,13 +230,18 @@ template <typename PA> class WithMessageParser {
       messages.Annex(std::move(state.messages()));
     } else {
       emitMessage = true;
+      emitAtStart = true;
       if (hadAnyTokenMatched) {
         state.set_anyTokenMatched();
       }
     }
     state.messages() = std::move(messages);
     if (emitMessage) {
-      state.Say(text_);
+      if (emitAtStart) {
----------------
mleair wrote:

Nit: This condition is now dead code.

 emitAtStart is always true when emitMessage is true, so the else branch is dead code, and this can be simplified to just state.Say(start, text_).


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


More information about the flang-commits mailing list