[flang-commits] [flang] [Flang] Reject keyword arguments in statement function calls (PR #198610)

via flang-commits flang-commits at lists.llvm.org
Sun May 31 04:41:33 PDT 2026


================
@@ -0,0 +1,15 @@
+! RUN: %python %S/test_errors.py %s %flang_fc1
+! Test F'2018 15.5.1 C1535 - keyword arguments are not allowed when the
+! interface is implicit. Statement functions have implicit interfaces.
+
+program test_stmt_func_keyword
+  integer :: f1, x, c
+
+  ! Statement function definition
+  f1(x) = x / 2
+
+  ! Calling a statement function with a keyword argument is not allowed
+  ! because statement functions have implicit interfaces.
+  !ERROR: Keyword 'x=' may not appear in a reference to a procedure with an implicit interface
+  c = f1(x=10)
----------------
blazie2004 wrote:

for `c = f1(y=10)` , i get this 
```
error: Keyword 'y=' may not appear in a reference to a procedure with an implicit interface
    c = f1(y=10)
           ^
error: Argument keyword 'y=' is not recognized for this procedure reference
    c = f1(y=10)
           ^
```

for stmt function with two args , i have changed the testcase which produces

```
error: Keyword 'x=' may not appear in a reference to a procedure with an implicit interface
    c = f2(x=10, y=20)
           ^
error: Keyword 'y=' may not appear in a reference to a procedure with an implicit interface
    c = f2(x=10, y=20)
                 ^
```



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


More information about the flang-commits mailing list