[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
Fri Aug 14 08:13:40 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) {
----------------
kwyatt-ext wrote:
emitMessage is set dynamically in the 2nd branch of the preceding conditional.
```
} else if (state.anyTokenMatched()) {
emitMessage = state.messages().empty();
messages.Annex(std::move(state.messages()));
} else {
```
Through that branch, it is possible for `emitMessage == true` and `emitAtStart == false`. I haven't tested it, but I think it would occur with a statement like `DATA x / /`. But it is possible to structure WithMessageParser calls that can reach that condition.
https://github.com/llvm/llvm-project/pull/215886
More information about the flang-commits
mailing list