- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am experimenting with a generic programming technique - via rename clauses, see the code below - and I get an error message about multiple PRIVATE statements being used. I do not quite understand why because the two statements are in separate modules:
module quaternion_def_basic implicit none type quaternion !type(complex) :: c(2) complex :: c(2) end type quaternion end module quaternion_def_basic module quaternion_def use quaternion_def_basic, only: T => quaternion end module quaternion_def module octonion_def use quaternion_def, T2 => T implicit none private :: T2 type T type(T2) :: c(2) end type T end module octonion_def module sedenion_def use octonion_def, T2 => T implicit none private :: T2 type T type(T2) :: c(2) end type T end module sedenion_def
If I comment out the PRIVATE statement in the sedenion_def module, the code is accepted. Can anyone point out whether this is a genuine programming error or something that is wrong in the compiler. FYI: gfortran does accept the code.
I am using Intel Fortran 2015 for this.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This appears to be a defect so I reported it to Development. It is also reproducible with PSXE 2016 (16.0 compiler). The clash appears to only involve the symbol. Tinkering with the test case to use a different name inside sedenion_def, I find that T2 from octonion_def is not accessible.
(Internal tracking id: DPD200376628)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
error #6265: This symbol has multiple PRIVATE statement/attribute declarations which is not allowed. [T2]
It look OK to me. If in sedenion_def your change t2 to t3 the problem goes away suggesting there is some namespace pollution from octonion_def in sedenion_def.
On another note the cascade of re-definitions using the USE rename feature I found really confusing. I had to read the code three times before I understood it. Do you really want to do such a thing?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Kevin, thanks for taking care of this.
app4619, I use the renaming bit to get a kind of templates within the current Fortran standard. If I were to use this in actual code, then I would chose more descriptive names, but this was a small illustration only :). It requires some careful thinking, I agree, but it seems a useful tool to set up generic code.

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