Debian Codegraph @

gcc/testsuite/gfortran.dg/module_procedure_5.f90

raw
1 ! { dg-do compile }
2 !
3 ! Test the fix for the testcase in comment 23 of PR96320, which used to
4 ! fail with the message: Variable ‘new_foo’ cannot appear in a variable
5 ! definition context.
6 !
7 ! Contributed by Damian Rouson <[email protected]>
8 !
9 module foobar
10 implicit none
11
12 type foo
13 integer bar
14 end type
15
16 interface
17 pure module function create() result(new_foo)
18 implicit none
19 type(foo) new_foo
20 end function
21 end interface
22
23 contains
24 module procedure create
25 new_foo%bar = 1 ! Error here
26 end procedure
27 end module
28
29 use foobar
30 print *, create ()
31 end