[C++ PATCH] Deprecate -ffriend-injection
[official-gcc.git] / gcc / testsuite / gfortran.dg / class_result_5.f90
blobc557ed3718099eb378a1fd7ea9c15d4445165c42
1 ! { dg-do run }
3 ! Test the fix for PR79072. The original problem was that an ICE
4 ! would occur in the select type construct. On fixing that, it was
5 ! found that the string length was not being transferred in the
6 ! pointer assignment in the main program.
8 ! Contributed by Neil Carlson <neil.n.carlson@gmail.com>
10 function foo(string)
11 class(*), pointer :: foo
12 character(3), target :: string
13 foo => string
14 select type (foo)
15 type is (character(*))
16 if (foo .ne. 'foo') call abort
17 foo = 'bar'
18 end select
19 end function
21 interface
22 function foo(string)
23 class(*), pointer :: foo
24 character(3), target :: string
25 end function
26 end interface
28 class(*), pointer :: res
29 character(3), target :: string = 'foo'
31 res => foo (string)
33 select type (res)
34 type is (character(*))
35 if (res .ne. 'bar') call abort
36 end select
37 if (string .ne. 'bar') call abort
38 end