- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The following source:
[fortran]MODULE MaterialStreamValues
IMPLICIT NONE
PRIVATE
TYPE, ABSTRACT, PUBLIC :: MaterialStreamValue
CONTAINS
PROCEDURE(ms_wflow_op), DEFERRED :: wflow_op
GENERIC :: OPERATOR(.WFlow.) => wflow_op
END TYPE MaterialStreamValue
ABSTRACT INTERFACE
ELEMENTAL FUNCTION ms_wflow_op(str) RESULT(wflow)
IMPORT :: MaterialStreamValue
IMPLICIT NONE
!-------------------------------------------------------------------------
CLASS(MaterialStreamValue), INTENT(IN) :: str
REAL :: wflow
END FUNCTION ms_wflow_op
END INTERFACE
END MODULE MaterialStreamValues
MODULE AqueousStreamValues
USE MaterialStreamValues
IMPLICIT NONE
PRIVATE
TYPE, EXTENDS(MaterialStreamValue), PUBLIC :: AqueousStreamValue
CONTAINS
PROCEDURE :: wflow_op => as_wflow_op
END TYPE AqueousStreamValue
CONTAINS
SUBROUTINE proc(str)
CLASS(AqueousStreamValue), INTENT(IN) :: str
REAL :: magnitude
!***************************************************************************
magnitude = .WFlow. str
END SUBROUTINE proc
ELEMENTAL FUNCTION as_wflow_op(str) RESULT(wflow)
CLASS(AqueousStreamValue), INTENT(IN) :: str
REAL :: wflow
!***************************************************************************
wflow = 2.0
END FUNCTION as_wflow_op
END MODULE AqueousStreamValues
[/fortran]
when compiled with ifort 13.0.0 gives an error that I think is bogus:
[plain]>ifort /c /check:all /warn:all /standard-semantics Ifort13GoesAndRuinsMyBeautifulTypeHierarchy.f90
Intel(R) Visual Fortran Compiler XE for applications running on IA-32, Version 13.0.0.089 Build 20120731
Copyright (C) 1985-2012 Intel Corporation. All rights reserved.
Ifort13GoesAndRuinsMyBeautifulTypeHierarchy.f90(36): error #6767: No matching user defined OPERATOR with the given type
and rank has been defined. [WFLOW]
magnitude = .WFlow. str
-----------------^
Ifort13GoesAndRuinsMyBeautifulTypeHierarchy.f90(39): remark #7712: This variable has not been used. [STR]
ELEMENTAL FUNCTION as_wflow_op(str) RESULT(wflow)
---------------------------------^
compilation aborted for Ifort13GoesAndRuinsMyBeautifulTypeHierarchy.f90 (code 1)[/plain]
This had me going cross-eyed trying to spot the spelling mistake/get a reproducer, until I realised that the order of the module procedures in the second module matters (put proc after as_wflow_op and the error goes away).
There be ice-bergs for the compiler not far away from this example too.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page