lanxueren121 发表于 2015-3-13 12:58:50

union不能用allocatable的问题

type T_client_server_message
                union
                     map
                        character*(500) buffer
                     end map
                     map
                        real,allocatable :: matrix1(:,:)
                        real,allocatable :: matrix2(:,:)
                        real,allocatable :: matrix3(:,:)
                     end map
                end union
         end type

想如此定义一个新的数据类型
但是出现错误
错误        3       error #7897: A UNION may not contain an ALLOCATABLE component           C:\Users\Administrator\Desktop\add server.f90        25       

错误        2       error #7897: A UNION may not contain an ALLOCATABLE component           C:\Users\Administrator\Desktop\add server.f90        24       

错误        1       error #7897: A UNION may not contain an ALLOCATABLE component           C:\Users\Administrator\Desktop\add server.f90        23       


要怎么才能解决呢??难道不能用动态数组了吗

fcode 发表于 2015-3-13 18:00:03

能用,但不能跟union   map 一起用

lanxueren121 发表于 2015-3-17 13:56:46

fcode 发表于 2015-3-13 18:00
能用,但不能跟union   map 一起用

可是我想把这个参数放在union map 里,如何在外部定义,然后在定义到里面呢?

fcode 发表于 2015-3-17 13:57:48

我办不到
页: [1]
查看完整版本: union不能用allocatable的问题