https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114438
--- Comment #2 from kargl at gcc dot gnu.org --- (In reply to anlauf from comment #1) > Can you be a little more explicit? > > If I extend the program as follows: > > type(params) :: p > p = params( 0.1, 2.0 ) > write(*,*) p > p = params( 0.1, 2 ) > write(*,*) p > > I get with all compilers I have access to (Intel, NAG, Nvidia, flang, > gfortran) > > Not the structure constructor > 0.100000001 4.00000000 > 0.100000001 2.00000000 > > This is what I would have naively expected in accordance with "Note 1": > > The form ’name(...)’ is interpreted as a generic function-reference if > possible; it is interpreted as a structure-constructor only if it cannot > be interpreted as a generic function-reference. > > which gives a precedence to function-reference over structure-constructor, > making it possible to override the default constructor. > > Are you saying that one cannot override the default constructor? I thought C7108 was clear. C7108 (R756) If derived-type-spec is a type name that is the same as a generic name, the component-spec-list shall not be a valid actual-arg-spec-list for a function reference that is resolvable as a generic reference to that name (15.5.5.2). The derived-type-spec is 'params'. The generic name is 'params'. The component-spec-list for the derived type in 'p = params(3.0,2.0)' has types of 'real' and 'real'. The generic reference is 'p = params(3.0,2.0)', which resolves to 'default_params'. 'default_params' has an actual-arg-spec-list with types of 'real' and 'real'. Thus, 'params(real,real)' is ambiguous. Is it the structure constructor or a generic function reference? Note, you cannot use keywords as the components of the derive type 'params' are 'x' and 'y', and the dummy arguments for 'default_params' are also 'x' and 'y'. Finally, 'p = params(3,2.0)' is a structure constructor, because the generic interface does not include a function with types of 'integer' and 'real'. Thus, here, this is not a function reference. It must be a structure constructor. The rules of intrinsic assignment are now in play, and 'params(3,2.0)' is treated as 'params(3.0,2.0)' after type conversion. Of course, I could be wrong.