<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/104796>104796</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Flang rejects named constant of derived type in pure procedure
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            flang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          everythingfunctional
      </td>
    </tr>
</table>

<pre>
    I documented the issue in [another repo](https://github.com/HPC-Bugs/reproducers/tree/main/compiler/Fortran/flang/constant-in-pure), but the following example is sufficient to reproduce the error.

```fortran
program example
    type :: my_type
 integer :: val
    end type
    print *, thing()
contains
 pure function thing()
        type(my_type) :: thing
 type(my_type), parameter :: constant = my_type(42)
        thing = constant
    end function
end program
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8U9GumzAM_ZrwYrVKDbTwwEPvrdD2tj-Y0mBoppAgJ3Tr30-hcLvtSkMIFOc45xw7ViGYwRE1onwT5SVTc7x5buhO_Ig344Z-djoa75TNrr57NF-h83oeyUXqIN4ITAgzgXEgyjflfLwRA9PkRXkRWN1inILIzwJbge1g4m2-7rUfBbZfvr3v3uYhCGyZJvbdrInTKjKRwHZUxglstR8nY4kFtq3nyCoFe6vcsGy6EJWLO-N208wksBb4Dtc5Ltp6b63_adwA9EuNk01qIcx9b7QhFyF6-KBeEojZ817Ii5Dn9XuUz7dfyZfoxH5gNW7HPoMAAPExESS_-RnGx_e0XDeNizQQb5t3ZV9Z5Dr4AwoAExsXQeA52VkaIbBK7haE9i4q48KKT85ha9RnNKzPwoDVJgvrTcsz44n9BEoCJsVqpPhSv9UdRH758IlVgZ9J09kLbMv52_Ym-xlNkbW2_5Q_65q8q_NaZdQcTljISmJeZ7em7-hYYCWRelno-njqy5JKqk5lecypqDLToEz4Q30oDzKv97Lsy0LT6ahlj7o7iULSqIzdW3sf956HbLnTzUEWp_qYWXUlG5YBQVwvHqZZ4SYl7K7pDhfSmhDD64hooqWmTXBg-kE6BnBqpO5VO99DR2zu9Gx-mqGlkxN7Td3MlM1sm_9MUCJbf7uJfSIR2C7i0xyt-u8N_g4AAP__NqM6EA">