! Copyright (c) 2010, NVIDIA CORPORATION.  All rights reserved.
!
! Licensed under the Apache License, Version 2.0 (the "License");
! you may not use this file except in compliance with the License.
! You may obtain a copy of the License at
!
!     http://www.apache.org/licenses/LICENSE-2.0
!
! Unless required by applicable law or agreed to in writing, software
! distributed under the License is distributed on an "AS IS" BASIS,
! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
! See the License for the specific language governing permissions and
! limitations under the License.
!       

program unlimited_poly
USE CHECK_MOD

  type my_type
  class(*),allocatable :: a
  class(*),pointer :: p
  end type

  integer z 
  logical,target :: l 
  logical results(2)
  logical expect(2)
  type(my_type) :: obj
  type(my_type),allocatable :: obj2

  class(*), allocatable :: u2(:)
  integer sa(5)
  integer, allocatable :: sa2(:)
  integer i,j,k

  do i=1,5
      sa(i) = i
 enddo

  results = .false.
  expect = .true.
  


   allocate(u2(5),source=sa)
   allocate(sa2(5))
   sa2 = -1

   select type(qq=>u2)
   type is (integer)
   print *, qq,sa2
   sa2 = qq
   results(1) = all(sa2 .eq. qq)
   end select
   print *, sa2

   results(2) = all(sa2 .eq. sa)

  call check(results,expect,2)
  
end program unlimited_poly


