summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/constructor_1.f90
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-21 09:36:11 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-21 09:36:11 +0000
commit8726b204214570b8506b06e7f1af935e21cb25c9 (patch)
tree197000f9c24e34c902c5357dd6d522f430ac0722 /gcc/testsuite/gfortran.dg/constructor_1.f90
parent0f3b427f9513aaff0bb89af90bb60fd21aa23ce8 (diff)
downloadgcc-8726b204214570b8506b06e7f1af935e21cb25c9.tar.gz
2011-11-21 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 181552 using svnmerge git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@181554 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gfortran.dg/constructor_1.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/constructor_1.f9042
1 files changed, 42 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/constructor_1.f90 b/gcc/testsuite/gfortran.dg/constructor_1.f90
new file mode 100644
index 00000000000..e8fe03ac38c
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/constructor_1.f90
@@ -0,0 +1,42 @@
+! { dg-do compile }
+!
+! PR fortran/39427
+!
+! Check constructor functionality.
+!
+! Contributed by Damian Rouson.
+!
+module mycomplex_module
+ private
+ public :: mycomplex
+ type mycomplex
+! private
+ real :: argument, modulus
+ end type
+ interface mycomplex
+ module procedure complex_to_mycomplex, two_reals_to_mycomplex
+ end interface
+! :
+ contains
+ type(mycomplex) function complex_to_mycomplex(c)
+ complex, intent(in) :: c
+! :
+ end function complex_to_mycomplex
+ type(mycomplex) function two_reals_to_mycomplex(x,y)
+ real, intent(in) :: x
+ real, intent(in), optional :: y
+! :
+ end function two_reals_to_mycomplex
+! :
+ end module mycomplex_module
+! :
+program myuse
+ use mycomplex_module
+ type(mycomplex) :: a, b, c
+! :
+ a = mycomplex(argument=5.6, modulus=1.0) ! The structure constructor
+ c = mycomplex(x=0.0, y=1.0) ! A function reference
+ c = mycomplex(0.0, 1.0) ! A function reference
+end program myuse
+
+! { dg-final { cleanup-modules "mycomplex_module" } }