Fortran Coder

查看: 10314|回复: 9
打印 上一主题 下一主题

[面向对象] 过程绑定中的通用接口冲突问题

[复制链接]

130

帖子

10

主题

0

精华

大师

F 币
617 元
贡献
372 点

贡献勋章管理勋章帅哥勋章元老勋章星光勋章规矩勋章

楼主
发表于 2020-8-10 21:50:54 | 显示全部楼层
Windows Absoft/Compaq/Intel/NAG/Silverfrost/NAG/G95 都是
test2,test3接口冲突: "test2" is not distinguishable (rank) from the "test3"

我認為PGI在這裡過於寬容

130

帖子

10

主题

0

精华

大师

F 币
617 元
贡献
372 点

贡献勋章管理勋章帅哥勋章元老勋章星光勋章规矩勋章

沙发
发表于 2020-8-10 23:05:15 | 显示全部楼层
[Fortran] 纯文本查看 复制代码
module pgi_generic                                                                    
  implicit none                                                                       
                                                                                      
  interface test                                                                      
    module procedure test2                                                            
    module procedure test3                                                            
  end interface test                                                                  
                                                                                      
contains !------------------------------                                              
                                                                                      
  subroutine test2(a)                                                                 
    implicit none                                                                     
    integer,intent(in) :: a(0:3)                                                      
                                                                                      
    write(*,*) a                                                                      
  end subroutine test2                                                                
                                                                                      
  !-----------------                                                                  
                                                                                      
  subroutine test3(a)                                                                 
    implicit none                                                                     
    integer,intent(in) :: a(3)                                                        
                                                                                      
    write(*,*) a                                                                      
  end subroutine test3                                                                
                                                                                      
end module pgi_generic                                                                
                                                                                      
!---------------------------------------                                              
                                                                                      
program test                                                                          
  use pgi_generic                                                                     
  implicit none                                                                       
                                                                                      
  integer :: a(0:3), b(3)                                                             
                                                                                      
  a = (/0, 1, 2, 3/)                                                                  
  b = (/4, 5, 6/)                                                                     
                                                                                      
  !---> PGI compile-time error: ambiguous interface for generic procedure test        
  CALL test(a)                                                                        
  CALL test(b)                                                                        
                                                                                      
end program test                                                                      


PGI沒有一陸錯到底

130

帖子

10

主题

0

精华

大师

F 币
617 元
贡献
372 点

贡献勋章管理勋章帅哥勋章元老勋章星光勋章规矩勋章

板凳
发表于 2020-8-10 23:06:46 | 显示全部楼层
抱歉, 是 "PGI沒有一路錯到底"

130

帖子

10

主题

0

精华

大师

F 币
617 元
贡献
372 点

贡献勋章管理勋章帅哥勋章元老勋章星光勋章规矩勋章

地板
发表于 2020-8-11 14:45:00 | 显示全部楼层
1. 理應於"定義端"偵測到錯誤, PGI遲至"使用端"才說有錯

2. 被"CONTAINS", 透過所謂的"HOST ASSOCIATION", 繼承"IMPLICIT NONE"
    個人以為還是寫比較好, ...
您需要登录后才可以回帖 登录 | 极速注册

本版积分规则

捐赠本站|Archiver|关于我们 About Us|小黑屋|Fcode ( 京ICP备18005632-2号 )

GMT+8, 2024-5-3 07:57

Powered by Tencent X3.4

© 2013-2024 Tencent

快速回复 返回顶部 返回列表