File: bind-c15.f90

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.8-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,696 kB
  • sloc: cpp: 7,438,781; ansic: 1,393,871; asm: 1,012,926; python: 241,771; f90: 86,635; objc: 75,411; lisp: 42,144; pascal: 17,286; sh: 8,596; ml: 5,082; perl: 4,730; makefile: 3,591; awk: 3,523; javascript: 2,251; xml: 892; fortran: 672
file content (52 lines) | stat: -rw-r--r-- 1,701 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic

module m
  type, bind(c) :: explicit_bind_c
    real a
  end type
  type :: interoperable1
    type(explicit_bind_c) a
  end type
  type, extends(interoperable1) :: interoperable2
    real b
  end type
  type :: non_interoperable1
    real, allocatable :: a
  end type
  type :: non_interoperable2
    type(non_interoperable1) b
  end type
  type :: no_bind_c
    real a
  end type
  type, bind(c) :: has_bind_c
    !WARNING: Derived type of component 'a' of an interoperable derived type should have the BIND attribute
    type(no_bind_c) :: a
  end type
  interface
    subroutine sub_bind_c_1(x_bind_c) bind(c)
      import explicit_bind_c
      type(explicit_bind_c), intent(in) :: x_bind_c
    end
    subroutine sub_bind_c_2(x_interop1) bind(c)
      import interoperable1
      !WARNING: The derived type of an interoperable object should be BIND(C)
      type(interoperable1), intent(in) :: x_interop1
    end
    subroutine sub_bind_c_3(x_interop2) bind(c)
      import interoperable2
      !WARNING: The derived type of an interoperable object should be BIND(C)
      type(interoperable2), intent(in) :: x_interop2
    end
    subroutine sub_bind_c_4(x_non_interop1) bind(c)
      import non_interoperable1
      !ERROR: The derived type of an interoperable object must be interoperable, but is not
      type(non_interoperable1), intent(in) :: x_non_interop1
    end
    subroutine sub_bind_c_5(x_non_interop2) bind(c)
      import non_interoperable2
      !ERROR: The derived type of an interoperable object must be interoperable, but is not
      type(non_interoperable2), intent(in) :: x_non_interop2
    end
  end interface
end