Bug 54035 - [OOP] TBP wrongly binds to a generic name if the specific name is the same
[OOP] TBP wrongly binds to a generic name if the specific name is the same
Status: NEW
Product: gcc
Classification: Unclassified
Component: fortran
4.8.0
: P3 normal
: ---
Assigned To: Not yet assigned to anyone
: accepts-invalid
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-19 18:24 UTC by Tobias Burnus
Modified: 2012-07-21 09:35 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2012-07-21 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2012-07-19 18:24:10 UTC
Reported by Erik Toussaint in comp.lang.fortran,
http://www.rhinocerus.net/forum/lang-fortran/710071-tbp-generic.html

The problem occurs if a generic name is a specific name – and the specific name is used in a type-bound procedure.

As the example shows, the type-bound procedure becomes also generic – and thus
  "call type%proc"
is all of a sudden generic.


module foo
    implicit none

    type t1
    contains
        procedure, nopass :: sub
    end type

    interface sub
        procedure sub
        procedure sub2
    end interface
contains
    subroutine sub
        print *, 'sub1'
    end subroutine

    subroutine sub2(arg1)
        integer arg1

        print *, 'sub2'
    end subroutine
end module

program bar
    use foo
    implicit none

    type(t1) obj

    call obj%sub
    call obj%sub(0)
end program
Comment 1 janus 2012-07-21 08:50:43 UTC
Related: PR 42418.
Comment 2 janus 2012-07-21 09:35:49 UTC
The problem is really that we have only one symbol for the specific and generic procedure.