https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127873
Bug ID: 127873
Summary: With -std=... permit using DoubleComplex as
derived-type name
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
Target Milestone: ---
Code like
https://github.com/elwasif/HeCBench-Fortran-OMP/blob/a411f31324832d6a5001d658ab8fb3bab4c4990c/src/complex-omp-fortran/main.f90
type :: DoubleComplex
real(real64) :: x, y
end type DoubleComplex
gets rejected in GCC:
src/complex-omp-fortran/main.f90:11:23:
11 | type :: DoubleComplex
| 1
Error: Type name ‘doublecomplex’ at (1) cannot be the same as an intrinsic type
ISO Fortran restriction is (only):
"C734 (R727) A derived type type-name shall not be DOUBLEPRECISION or the same
as the name of any intrinsic type defined in this document."
NOTE: doublecomplex is a common compiler extension, dating from the time
kind arguments were not really used.
Still, it should be usable with doublecomplex:
Possible solution:
* Accept it with -std=... and only error with --std=gnu...
* Always accept it - implies: 'type(doublecomplex) ::' shall not match that
intrinsic type - while 'doublecomplex ::
Possible better is the second option?!? And we may want to update the
documentation.
Cf. also
https://flang.llvm.org/docs/Extensions.html#extensions-deletions-and-legacy-features-supported-by-default