Silverfrost Forums

Welcome to our forums

compiler error when overloading procedures

6 Feb 2007 9:18 #1617

Hi,

I also came across the following spurious error when overloading procedures in FTN95.

Line 44: error 283 - DOT_PRODUCT must appear in a type declaration because IMPLICIT NONE has been used

this is despite the fact that in this example DOT_PRODUCT invokes the intrinsic procedure, not the overloaded extension. Adding DOT_PRODUCT to the use statement removes the error yet, according to the standard, should not be necessary. Not the worst bug possible but a bug nonetheless.

!***************** module mod implicit none private public::func,dot_product ! this overloads the new routine onto the ! same name as the intrinsic dot_product, ! which is legal F-95. interface dot_product module procedure dot_product2 endinterface dot_product contains !------ function func(x) implicit none real,intent(in)x realfunc func=x2 endfunction func !------ function dot_product2(x) implicit none real,intent(in)x(:) realdot_product2 dot_product2=dot_product(x,x) endfunction dot_product2 !------ endmodule mod !*************** module mod2 use mod,only:func implicit none contains subroutine test(x) real,intent(inout)::x(:) x(1)=func(x(1)) ! the next call uses the intrinsic dot_product, not the ! overloaded extension. My reading of the F-95 standard ! suggests it is not necessary to declare ! 'dot_product' in the USE statement. ! However when compiling with FTN95 the compiler ! reports an error and asks that dot_product be ! declared. This should not be necessary. x=dot_product(x,(/3.0,6.0/)) endsubroutine test endmodule mod2 !*****************

7 Feb 2007 9:46 #1627

I have logged this as something to investigate.

Please login to reply.