coarray_41.f90: Add "-latomic" option if libatomic_available.
[official-gcc.git] / gcc / testsuite / gfortran.dg / proc_ptr_comp_3.f90
blobeb1d84555ddb1067ca6952fc55e113a8b5daaf81
1 ! { dg-do compile }
3 ! PR39630: Fortran 2003: Procedure pointer components.
5 ! Probing some error messages.
7 ! Contributed by Janus Weil <janus@gcc.gnu.org>
9 implicit none
11 interface
12 subroutine sub
13 end subroutine
14 end interface
16 external :: aaargh
18 type :: t
19 procedure(), pointer, nopass :: ptr1
20 procedure(real), pointer, nopass :: ptr2
21 procedure(sub), pointer, nopass :: ptr3
22 procedure(), pointer, nopass ptr4 ! { dg-error "Expected '::'" }
23 procedure(), pointer, nopass, pointer :: ptr5 ! { dg-error "Duplicate" }
24 procedure, pointer, nopass :: ptr6 ! { dg-error "Syntax error" }
25 procedure(), nopass :: ptr8 ! { dg-error "POINTER attribute is required" }
26 procedure(pp), pointer, nopass :: ptr9 ! { dg-error "declared in a later PROCEDURE statement" }
27 real :: y
28 end type t
30 type :: t2
31 procedure(aaargh), pointer, nopass :: ptr10 ! { dg-error "must be explicit" }
32 end type
34 type,bind(c) :: bct ! { dg-error "BIND.C. derived type" }
35 procedure(), pointer,nopass :: ptr ! { dg-error "cannot be a member of|may not be C interoperable" }
36 end type bct
38 procedure(sub), pointer :: pp
40 type(t) :: x
42 x%ptr2 => x ! { dg-error "Invalid procedure pointer assignment" }
44 x => x%ptr2 ! { dg-error "Non-POINTER in pointer association context" }
46 print *, x%ptr1() ! { dg-error "attribute conflicts with" }
47 call x%ptr2() ! { dg-error "attribute conflicts with" }
48 print *,x%ptr3() ! { dg-error "attribute conflicts with" }
50 call x%y ! { dg-error "Expected type-bound procedure or procedure pointer component" }
52 end