Fortran OOP circular dependency handling, interfaces

孤街浪徒 提交于 2019-12-06 15:50:43

Your code is correct Fortran 2003. You are handling the circular type dependency in the correct way. The compiler is in error.

I have experienced and seen others report issues with ifort 12.1.5 and programmer overrides of structure constructors (where there is a generic interface to a function that has a derived type result, with the interface having the same name as the derived type - as you have here). A workaround for this situation to rename the generic interface (and subsequent references) for the constructor function to a name different from the derived type.

Even though 2003 sounds long ago, implementation of fortran 2003 is still an ongoing process in most compilers. There may very well still be omissions or bugs in the handling of new features.

Check with the support team of your compiler if this is a known issue, and, if so, if there is a newer version that fixes this.

As supporting - though not conclusive - evidence that this code is standard conforming, gfortran compiles it without error (just two warnings about not setting a return value for the functions).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!