File tree Expand file tree Collapse file tree 4 files changed +35
-4
lines changed Expand file tree Collapse file tree 4 files changed +35
-4
lines changed Original file line number Diff line number Diff line change @@ -440,3 +440,34 @@ end subroutine
440
440
The precedent among the most commonly used compilers
441
441
agrees with f18's interpretation: a ` DATA ` statement without any other
442
442
specification of the name refers to the host-associated object.
443
+
444
+ * Many Fortran compilers allow a non-generic procedure to be ` USE ` -associated
445
+ into a scope that also contains a generic interface of the same name
446
+ but does not have the ` USE ` -associated non-generic procedure as a
447
+ specific procedure.
448
+ ```
449
+ module m1
450
+ contains
451
+ subroutine foo(n)
452
+ integer, intent(in) :: n
453
+ end subroutine
454
+ end module
455
+
456
+ module m2
457
+ use m1, only: foo
458
+ interface foo
459
+ module procedure noargs
460
+ end interface
461
+ contains
462
+ subroutine noargs
463
+ end subroutine
464
+ end module
465
+ ```
466
+
467
+ This case elicits a warning from f18, as it should not be treated
468
+ any differently than the same case with the non-generic procedure of
469
+ the same name being defined in the same scope rather than being
470
+ ` USE ` -associated into it, which is explicitly non-conforming in the
471
+ standard and not allowed by most other compilers.
472
+ If the ` USE ` -associated entity of the same name is not a procedure,
473
+ most compilers disallow it as well.
Original file line number Diff line number Diff line change @@ -3196,8 +3196,8 @@ void InterfaceVisitor::CheckGenericProcedures(Symbol &generic) {
3196
3196
auto &details{generic.get <GenericDetails>()};
3197
3197
if (auto *proc{details.CheckSpecific ()}) {
3198
3198
auto msg{
3199
- " '%s' may not be the name of both a generic interface and a"
3200
- " procedure unless it is a specific procedure of the generic" _err_en_US };
3199
+ " '%s' should not be the name of both a generic interface and a"
3200
+ " procedure unless it is a specific procedure of the generic" _warn_en_US };
3201
3201
if (proc->name ().begin () > generic.name ().begin ()) {
3202
3202
Say (proc->name (), std::move (msg));
3203
3203
} else {
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ module m2
11
11
interface s
12
12
end interface
13
13
contains
14
- ! ERROR : 's' may not be the name of both a generic interface and a procedure unless it is a specific procedure of the generic
14
+ ! WARNING : 's' should not be the name of both a generic interface and a procedure unless it is a specific procedure of the generic
15
15
subroutine s
16
16
end subroutine
17
17
end module
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ subroutine foo(x)
11
11
module m2
12
12
use m1
13
13
implicit none
14
- ! ERROR : 'foo' may not be the name of both a generic interface and a procedure unless it is a specific procedure of the generic
14
+ ! WARNING : 'foo' should not be the name of both a generic interface and a procedure unless it is a specific procedure of the generic
15
15
interface foo
16
16
module procedure s
17
17
end interface
You can’t perform that action at this time.
0 commit comments