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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2019-05-17
   Target Milestone|---                         |7.5
     Ever confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Confirmed from GCC7 up to trunk (10.0). Assignment to an allocatable
polymorphic variable is not supported on earlier versions.

as suggested at
https://groups.google.com/forum/#!topic/comp.lang.fortran/Phl5wkOoW3Q
the test compiles with the following changes

--- pr90506.f90 2019-05-17 13:47:48.000000000 +0200
+++ pr90506_db.f90      2019-05-17 13:58:43.000000000 +0200
@@ -17,24 +17,24 @@ contains
   subroutine do_stuff (f_maker)

     interface
-       function f_maker () result (f)
+       subroutine f_maker (f)
          import f_t
          class(f_t), allocatable :: f
-       end function f_maker
+       end subroutine f_maker
     end interface

     class(f_t), allocatable :: f

-    f = f_maker()
+    call f_maker (f)   !<--- 

   end subroutine do_stuff

-  function g_maker () result (g)
+  subroutine g_maker (g)

     class(f_t), allocatable :: g

-    g = g_t(a=1.,b=1.)
+    allocate( g, source= g_t( a=1.0, b=1.0 ) )  !<--- [B] no error 

-  end function g_maker
+  end subroutine g_maker

 end program test_poly

Reply via email to