[flang-commits] [flang] [Flang] Give a more specific error message for expressions where an IO Unit is expected (PR #126970)

Andre Kuhlenschmidt via flang-commits flang-commits at lists.llvm.org
Wed Feb 26 13:43:01 PST 2025


================
@@ -23,8 +23,12 @@ namespace Fortran::parser {
 // R905 char-variable -> variable
 // "char-variable" is attempted first since it's not type constrained but
 // syntactically ambiguous with "file-unit-number", which is constrained.
+// Note, "file-unit-number" is replaced by "expr" to allow for better
+// error messages.
 TYPE_PARSER(construct<IoUnit>(variable / lookAhead(space / ",);\n"_ch)) ||
-    construct<IoUnit>(fileUnitNumber) || construct<IoUnit>(star))
+    construct<IoUnit>(
----------------
akuhlens wrote:

When I was looking into it the other uses of fileUnitNumber in this file don't have the same overlap with a character variable that can lead to this issue, and thus I don't think they would benefit from this.

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


More information about the flang-commits mailing list