1! { dg-do compile } 2! 3! PR 41719: [OOP] invalid: Intrinsic assignment involving polymorphic variables 4! 5! Contributed by Tobias Burnus <burnus@gcc.gnu.org> 6 7 implicit none 8 9 type t1 10 integer :: a 11 end type 12 13 type, extends(t1) :: t2 14 integer :: b 15 end type 16 17 class(t1),pointer :: cp 18 type(t2) :: x 19 20 x = t2(45,478) 21 allocate(t2 :: cp) 22 23 cp = x ! { dg-error "Nonallocatable variable must not be polymorphic" } 24 25 select type (cp) 26 type is (t2) 27 print *, cp%a, cp%b 28 end select 29 30end 31