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/47136] [OOP] possible name resolution problems between MODULE and INTERFACE?


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

--- Comment #6 from janus at gcc dot gnu.org 2011-01-02 15:19:10 UTC ---
(In reply to comment #5)
> > It
> > doesn't know OOP to test, but one could think that my initial example is
> > invalid after all?!
> 
> I agree that it may be invalid, but one should check the exact wording in the
> standard.

Yes, after a look in the standard I would say that is invalid according to F08,
chapter 16.3.1, sentence #2:

"Within its scope, a local identiïer of an entity of class (1) or class (4)
shall not be the same as a global identiïer used in that scope unless [...]"

Class (1) contains all sorts of named variables and procedures, including
abstract interfaces. The exceptions which I elided in the above statement do
not apply. The only question is whether a module counts as "used" in it's own
scope, which I would answer with yes.

Therefore I think already the following reduction of comment #0 is invalid:

MODULE a
  ABSTRACT INTERFACE
    SUBROUTINE s()
    END SUBROUTINE
  END INTERFACE
END MODULE

MODULE s
  USE a
END MODULE

Within the scope of module "a" everything is fine, since the module "s" is not
used. Within the scope of module "s", however, the subroutine "s" is a local
identifier (by means of use association) and conflicts with the global
identifier of module "s" itself. Right?


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