Commit forgotten file
authorMikael Morin <mikael@gcc.gnu.org>
Thu, 13 Jun 2013 14:30:17 +0000 (14:30 +0000)
committerMikael Morin <mikael@gcc.gnu.org>
Thu, 13 Jun 2013 14:30:17 +0000 (14:30 +0000)
From-SVN: r200070

gcc/testsuite/gfortran.dg/typebound_assignment_5.f03 [new file with mode: 0644]

diff --git a/gcc/testsuite/gfortran.dg/typebound_assignment_5.f03 b/gcc/testsuite/gfortran.dg/typebound_assignment_5.f03
new file mode 100644 (file)
index 0000000..33fc38f
--- /dev/null
@@ -0,0 +1,40 @@
+! { dg-do run }
+!
+! PR fortran/49074
+! ICE on defined assignment with class arrays.
+
+      module foo
+        type bar
+          integer :: i
+
+          contains
+
+          generic :: assignment (=) => assgn_bar
+          procedure, private :: assgn_bar
+        end type bar
+
+        contains
+
+        elemental subroutine assgn_bar (a, b)
+          class (bar), intent (inout) :: a
+          class (bar), intent (in) :: b
+
+          select type (b)
+          type is (bar)
+            a%i = b%i
+          end select
+
+          return
+        end subroutine assgn_bar
+      end module foo
+
+      program main
+        use foo
+
+        type (bar), allocatable :: foobar(:)
+
+        allocate (foobar(2))
+        foobar = [bar(1), bar(2)]
+        if (any(foobar%i /= [1, 2])) call abort
+      end program
+