|
| 1 | +! Test for use fArgParse use case that fails with ifort-19. Issue is |
| 2 | +! apparently related to copying of StringUnlimited maps at multiple |
| 3 | +! levels. In the use case a function is used to return a map, and the |
| 4 | +! retun value is itself a function return at the level above. |
| 5 | + |
| 6 | +module String_mod |
| 7 | + implicit none |
| 8 | + private |
| 9 | + |
| 10 | + public :: String |
| 11 | + type :: String |
| 12 | + character(:), allocatable :: string |
| 13 | + end type String |
| 14 | + |
| 15 | +end module String_mod |
| 16 | + |
| 17 | +module UnlimitedMap_mod |
| 18 | +#include "types/key_deferredLengthString.inc" |
| 19 | +#include "types/value_unlimitedPoly.inc" |
| 20 | +#define _alt |
| 21 | +#include "templates/map.inc" |
| 22 | +end module UnlimitedMap_mod |
| 23 | + |
| 24 | + |
| 25 | +module Test_map_double_assigne_mod |
| 26 | + use String_mod |
| 27 | + use pFUnit_mod |
| 28 | + use UnlimitedMap_mod |
| 29 | + |
| 30 | + @suite(name='Test_map_double_assign_suite') |
| 31 | + |
| 32 | + type :: ArgParser |
| 33 | + class(*), allocatable :: default |
| 34 | + end type ArgParser |
| 35 | + |
| 36 | + |
| 37 | +contains |
| 38 | + |
| 39 | + subroutine get_defaults(this, option_values) |
| 40 | + type (Map), intent(out) :: option_values |
| 41 | + class (ArgParser), target, intent(inout) :: this |
| 42 | + |
| 43 | + class(*), pointer :: q |
| 44 | + |
| 45 | + this%default = 'TestRunner' |
| 46 | + q => this%default |
| 47 | + |
| 48 | + select type (q) |
| 49 | + type is (character(*)) |
| 50 | + print*,__FILE__,__LINE__ |
| 51 | + call option_values%insert('runner', String(q)) |
| 52 | + end select |
| 53 | + |
| 54 | + end subroutine get_defaults |
| 55 | + |
| 56 | + @test |
| 57 | + subroutine test_unlimited |
| 58 | + type (Map) :: m |
| 59 | + type (ArgParser) :: p |
| 60 | + |
| 61 | + class(*), pointer :: opt |
| 62 | + |
| 63 | + print*,__FILE__,__LINE__ |
| 64 | + call get_defaults(p, m) |
| 65 | + opt => m%at('runner') |
| 66 | + select type (opt) |
| 67 | + class is (String) |
| 68 | + @assertEqual('TestRunner', opt%string) |
| 69 | + class default |
| 70 | + @assertFalse(.true.,message='should not get here') |
| 71 | + end select |
| 72 | + |
| 73 | + end subroutine test_unlimited |
| 74 | +end module Test_map_double_assigne_mod |
0 commit comments