OSDN Git Service

* obj-c++.dg/comp-types-10.mm: XFAIL for ICE.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / assumed_charlen_function_3.f90
1 ! { dg-do compile }\r
2 ! Tests the patch for PRs 25084, 20852, 25085 and 25086, all of\r
3 ! which involve assumed character length functions.\r
4 ! This test checks the things that should not emit errors.\r
5 !\r
6 ! Contributed by Paul Thomas  <pault@gcc.gnu.org>\r
7 !\r
8 function is_OK (ch)                ! { dg-warning "is obsolescent in fortran 95" }\r
9   character(*) is_OK, ch           ! OK in an external function\r
10   is_OK = ch\r
11 end function is_OK\r
12 \r
13 ! The warning occurs twice for the next line; for 'more_OK' and for 'fcn';\r
14 function more_OK (ch, fcn)         ! { dg-warning "is obsolescent in fortran 95" }\r
15   character(*) more_OK, ch\r
16   character (*), external :: fcn   ! OK as a dummy argument\r
17   more_OK = fcn (ch)\r
18 end function more_OK\r
19 \r
20   character(4) :: answer\r
21   character(4), external :: is_OK, more_OK\r
22 \r
23   answer = is_OK ("isOK")          ! LEN defined in calling scope\r
24   print *, answer\r
25 \r
26   answer = more_OK ("okay", is_OK) ! Actual arg has defined LEN\r
27   print *, answer\r
28 \r
29   answer = also_OK ("OKOK")\r
30   print *, answer\r
31 \r
32 contains\r
33   function also_OK (ch)\r
34     character(4) also_OK\r
35     character(*) ch\r
36     also_OK = is_OK (ch)            ! LEN obtained by host association\r
37   end function also_OK\r
38 END\r
39 \r