Skip to content

An explicit type for a generic intrinsic function should not be allowed #198

Open
@klausler

Description

@klausler

This program conforms to Fortran 2018:

integer :: cos
print *, cos(3.14159)
end

and prints -1.00000, or some other amount of zeroes, with every Fortran compiler to which I have access. The call to cos() returns a REAL no matter what the explicit type declaration may be. One compiler emits a warning.

An explicit type-declaration-stmt for a generic intrinsic function is defined to have "no effect" (subclause 8.2, paragraph 3).

This behavior is unintuitive at best, useful only for stumping Fortran programmers as a trivia question, and may even perhaps be dangerous -- implementations are free to extend their lists of intrinsic procedures, and a name clash could silently break existing code that uses an implicit interface.

This feature should be deleted. Existing programs with currently ignored type declarations could be trivially brought up to date without ambiguity or loss of compatibility by simply deleting the declarations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Clause 8Standard Clause 8: Attribute declarations and specifications

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions