https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111477

Damian Rouson <damian at archaeologic dot codes> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |damian at archaeologic dot 
codes

--- Comment #1 from Damian Rouson <damian at archaeologic dot codes> ---
This is a feature that was added in the Fortran 2008 standard as I believe the
introduction of the standard states, but I'm having a hard time tracking down
the relevant language in the standard.  If I recall correctly, the Fortran 2008
standard neglected to mention in the Introduction that this feature was added. 
Then somewhere in the 2018 (or maybe the 2023 standard), there's a list of
features that were added in previous standards but not mentioned in the
introduction to those previous standards.

I just isolated the reproducer below and then realized it's probably redundant
with the one already posted in the initial bug report.

 % gfortran --version
GNU Fortran (Homebrew GCC 14.2.0_1) 14.2.0

% gfortran all.F90 
all.F90:35:22:

   35 |   test_description = test_description_t(do_something)
      |                      1
Error: Component 'test_function_' at (1) is a PRIVATE component of
'test_description_t'

%  cat all.F90 
module julienne_test_description_m
  implicit none

  private
  public :: test_description_t

  abstract interface
    function test_function_i() result(passed)
      implicit none
      logical passed
    end function
  end interface

  type test_description_t
    private
    procedure(test_function_i), pointer, nopass :: test_function_ => null()
  end type

  interface test_description_t
    module procedure construct_from_character_and_test_function
  end interface

contains
  function construct_from_character_and_test_function(test_function)
result(test_description)
    procedure(test_function_i), intent(in), pointer :: test_function
    type(test_description_t) test_description
    test_description%test_function_ => test_function
  end function
end module

program gfortran_reproducer
  use julienne_test_description_m
  implicit none
  type(test_description_t) test_description
  test_description = test_description_t(do_something)
contains
  logical function do_something()
    do_something = .false.
  end function
end program

Reply via email to