OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gfortran.dg/] [constructor_1.f90] - Blame information for rev 694

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 694 jeremybenn
! { dg-do compile }
2
!
3
! PR fortran/39427
4
!
5
! Check constructor functionality.
6
!
7
! Contributed by Damian Rouson.
8
!
9
module mycomplex_module
10
   private
11
   public :: mycomplex
12
   type mycomplex
13
!      private
14
      real :: argument, modulus
15
   end type
16
   interface mycomplex
17
      module procedure complex_to_mycomplex, two_reals_to_mycomplex
18
   end interface
19
!   :
20
   contains
21
      type(mycomplex) function complex_to_mycomplex(c)
22
         complex, intent(in) :: c
23
!         :
24
      end function complex_to_mycomplex
25
      type(mycomplex) function two_reals_to_mycomplex(x,y)
26
         real, intent(in)           :: x
27
         real, intent(in), optional :: y
28
!         :
29
       end function two_reals_to_mycomplex
30
!       :
31
    end module mycomplex_module
32
!    :
33
program myuse
34
    use mycomplex_module
35
    type(mycomplex) :: a, b, c
36
!    :
37
    a = mycomplex(argument=5.6, modulus=1.0)  ! The structure constructor
38
    c = mycomplex(x=0.0, y=1.0)               ! A function reference
39
    c = mycomplex(0.0, 1.0)               ! A function reference
40
end program myuse
41
 
42
! { dg-final { cleanup-modules "mycomplex_module" } }

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.