| 1 |
! { dg-do compile } |
| 2 |
! |
| 3 |
! PR 44649: [OOP] F2008: storage_size intrinsic |
| 4 |
! |
| 5 |
! Contributed by Janus Weil <[email protected]> |
| 6 |
|
| 7 |
use iso_c_binding, only: c_int, c_sizeof |
| 8 |
|
| 9 |
type, bind(c) :: t |
| 10 |
integer(c_int) :: j |
| 11 |
end type |
| 12 |
|
| 13 |
integer(4) :: i1 |
| 14 |
integer(c_int) :: i2 |
| 15 |
type(t) :: x |
| 16 |
|
| 17 |
print *,c_sizeof(i1) |
| 18 |
print *,c_sizeof(i2) |
| 19 |
print *,c_sizeof(x) |
| 20 |
print *, c_sizeof(ran()) |
| 21 |
|
| 22 |
print *,storage_size(1.0,4) |
| 23 |
print *,storage_size(1.0,3.2) ! { dg-error "must be INTEGER" } |
| 24 |
print *,storage_size(1.0,(/1,2/)) ! { dg-error "must be a scalar" } |
| 25 |
print *,storage_size(1.0,irand()) ! { dg-error "must be a constant" } |
| 26 |
|
| 27 |
end |