Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Still going dotty over user defined operators

IanH
Honored Contributor III
486 Views

(For some history http://software.intel.com/en-us/forums/topic/291295, but please note that I've changed my hair style since that photo was taken.)

The following:

[fortran]

MODULE GiveMeADot
  IMPLICIT NONE
  PRIVATE
 
  PUBLIC :: OPERATOR(.UnaryOp.)
 
  TYPE, PUBLIC :: MyType
  END TYPE MyType
 
  INTERFACE OPERATOR(.UnaryOp.)
    PROCEDURE unary_op
  END INTERFACE OPERATOR(.UnaryOp.)
CONTAINS  
  FUNCTION unary_op(arg) RESULT(str)
    TYPE(MyType), INTENT(IN) :: arg
    CHARACTER(5) :: str
    !****
    str = 'world'
  END FUNCTION unary_op
END MODULE GiveMeADot

PROGRAM StillDotty
  USE GiveMeADot
  IMPLICIT NONE
  TYPE(MyType) :: object
  WRITE (*, "(A)") 'Hello ' // .UnaryOp. object
END PROGRAM StillDotty
[/fortran]

(For some reason, omitting the module keyword in the procedure statement gives me a little thrill related to stepping into the brave unknown (perhaps due to the inability to back-level compiler should the need arise...), but I digress...)

gives:

[plain]

>ifort /check:all /warn:all /standard-semantics StillDotty.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.

StillDotty.f90(14): remark #7712: This variable has not been used.   [ARG]
  FUNCTION unary_op(arg) RESULT(str)
--------------------^
StillDotty.f90(26): error #5082: Syntax error, found '.' when expecting one of: .
  WRITE (*, "(A)") 'Hello ' // .UnaryOp. object
---------------------------------------^
compilation aborted for StillDotty.f90 (code 1)

[/plain]

The unexpected error about expecting nothing dashes (vs dots) my expectations...

0 Kudos
1 Reply
Steven_L_Intel1
Employee
486 Views
Thanks - escalated as issue DPD200236931.
0 Kudos
Reply