Re: Defining new operators



"Matthew Nobes" <nobes@xxxxxxxxxxxxxxxx> wrote in message
news:slrnd725bg.5em.nobes@xxxxxxxxxxxxxxxxxxxxxxxx

> type(mom), dimension(4), intent(in) :: k1,k2
> print *, .getpol.k1

> in a module, and try to compile that I get

> matt@smedley:~/Projects/fermilabpt/tmp $ ifort -c colourmod.f90
> fortcom: Error: colourmod.f90, line 15: A unary defined OPERATOR
> definition is missi\ng or incorrect. [GETPOL]
> print *, .getpol.k1
> --------------^
> compilation aborted for colourmod.f90 (code 1)

> I'm sure I'm doing something dumb here, but I cannot understand what it
> is. The new operator works fine when used in the main program...

Your problem is that you are attempting to invoke a function
with a rank-1 actual argument associated with a scalar dummy
argument. This only works if the function is elemental, but
yours can't be because it returns a rank-1 result given a
scalar input. You will have to write a version that accepts
a rank-1 dummy and produces a rank-2 result and then include
that function's name in your module procedure statement.

--
write(*,*) transfer((/17.392111325966148d0,6.5794487871554595D-85, &
6.0134700243160014d-154/),(/'x'/)); end


.