view gcc/testsuite/gfortran.dg/structure_constructor_2.f03 @ 127:4c56639505ff

fix function.c and add CbC-example Makefile
author mir3636
date Wed, 11 Apr 2018 18:46:58 +0900
parents 04ced10e8804
children 84e7813d76e9
line wrap: on
line source

! { dg-do run }
! Structure constructor with component naming.

PROGRAM test
  IMPLICIT NONE

  ! Structure of basic data types
  TYPE :: basics_t
    INTEGER :: i
    REAL :: r
    COMPLEX :: c
    LOGICAL :: l
  END TYPE basics_t

  TYPE(basics_t) :: basics

  basics = basics_t (42, -1.5, c=(.5, .5), l=.FALSE.)
  IF (basics%i /= 42 .OR. basics%r /= -1.5 &
      .OR. basics%c /= (.5, .5) .OR. basics%l) THEN
    CALL abort()
  END IF

  basics = basics_t (r=-1.5, i=42, l=.FALSE., c=(.5, .5))
  IF (basics%i /= 42 .OR. basics%r /= -1.5 &
      .OR. basics%c /= (.5, .5) .OR. basics%l) THEN
    CALL abort()
  END IF

END PROGRAM test