gfortran rejects the following: function bug(i) result(c) integer, pointer :: i character(len=merge(1,2, associated(p)) :: c end function bug
Error: Inquiry function 'associated' at (1) is not permitted in an initialization expression However according to 7.1.6.2 of ISO/IEC1539-1 there is no such prohibition: R734: specification-expr is scalar-int-expr Constraint: scalar-int-expr shall be a restricted expression: A restricted expression is [composed of] (2) a variable that is a dummy argument that has neither then OPTIONAL nor the INTENT(OUT) attribut [...] [ie referencing a POINTER argument is ok] [...] (8) a reference to any other intrinsic function defined in this standard where each argument is a restricted expression. [...] (and indeed no other compiler I have access to has complained about this.) -- Summary: gfortran rejects valid initialization expression Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: tow21 at cam dot ac dot uk http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33957