[C++ PATCH] Deprecate -ffriend-injection
[official-gcc.git] / gcc / testsuite / gfortran.dg / class_result_6.f90
blob44e17a22025c0f2fe1b8c2875f1336568f7300ab
1 ! { dg-do run }
3 ! Test the fix for PR79072 comment #12. A description of the problem
4 ! is to be found in class_result_5.f90.
6 ! Contributed by Neil Carlson <neil.n.carlson@gmail.com>
8 character(3), target :: a = 'foo'
9 class(*), pointer :: b
10 b => ptr()
11 select type (b)
12 type is (character(*))
13 if (a .ne. "bar") call abort
14 end select
15 contains
16 function ptr()
17 class(*), pointer :: ptr
18 ptr => a
19 select type (ptr)
20 type is (character(*))
21 ptr = "bar"
22 end select
23 end function
24 end