Gam*_*aSQ 5 fortran gfortran type-definition
我正在学习Fortran,并且想将数组和子例程封装为一种类型。问题似乎出在自对象的类型定义中。
这是我想出的最小测试用例:
module testing
implicit none
type test(para)
integer, len :: para
real, dimension(para) :: weights
contains
procedure :: testing => testing_test
end type
contains
subroutine testing_test(self)
class(test(*)) :: self
end subroutine
end module
Run Code Online (Sandbox Code Playgroud)
使用gfortran进行编译会引发以下错误:
module_test.f08:9:23:
procedure :: testing => testing_test
1
Error: Argument ‘self’ of ‘testing_test’ with PASS(self) at (1) must be of the derived-type ‘test’
Run Code Online (Sandbox Code Playgroud)
它在固定数组长度(因此type%para不存在)时起作用
我要做什么(带有可变大小的数组和绑定过程的类型)很简单,还是我缺少有关伪参数定义的内容?
感谢@Rodrigo的想法,我终于找到了这个错误(和补丁): https://gcc.gnu.org/bugzilla/show_bug.cgi ?id=82943
要解决此问题,请下载源代码,应用提到的补丁并编译您自己的 gfortran。(或者等到它进入存储库)
| 归档时间: |
|
| 查看次数: |
172 次 |
| 最近记录: |