This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/42167] New: TYPE IS and CLASS IS expect arguments after a type named after a function


When the argument to a TYPE IS construct is a function result variable with the
same name as the encompassing function, the compiler interprets the variable as
a function invocation and fails without arguments.  The code below produces the
error message below the code.  Also, replacing TYPE IS with CLASS IS produces
the same result.

Damian

$ cat select_type.f03
module bar_module
  implicit none
  type :: bar
    real ,dimension(:) ,allocatable :: f
  contains
    procedure :: total
  end type

contains

  function total(lhs,rhs)
    class(bar) ,intent(in) :: lhs
    class(bar) ,intent(in) :: rhs
    class(bar) ,pointer :: total
    select type(rhs)
      type is (bar)
        allocate(bar :: total)
        select type(total)
          type is (bar)
            total%f = lhs%f + rhs%f
        end select
    end select
  end function

$ gfortran -c select_type.f03
select_type.f03:18.25:

        select type(total)
                         1
Error: Function 'total' requires an argument list at (1)
select_type.f03:20.17:

            total%f = lhs%f + rhs%f
                 1
Error: 'total' at (1) is not a variable
select_type.f03:22.7:

    end select
       1
Error: Expecting END FUNCTION statement at (1)


-- 
           Summary: TYPE IS and CLASS IS expect arguments after a type named
                    after a function
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: damian at rouson dot net
 GCC build triplet: Mac OS X 10.5.8
  GCC host triplet: Mac OS X 10.5.8
GCC target triplet: Mac OS X 10.5.8


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42167


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]