<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/55300>55300</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Declaration of a derived-type pointer fails if the type itself is declared afterwards and there is a generic interface with the same name
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
chilikink
</td>
</tr>
</table>
<pre>
With flang on the main branch (commit 1616bd9ef4eb46a340a8765eab440f99e9008003), compilation of the following code:
```
MODULE M
TYPE T1
CLASS(T2), POINTER :: P
END TYPE
TYPE T2
TYPE(T1) T
END TYPE
INTERFACE T2
PROCEDURE T2_CONSTRUCTOR
END INTERFACE
CONTAINS
TYPE(T2) FUNCTION T2_CONSTRUCTOR()
END FUNCTION
END MODULE
```
results in an error:
```
$ flang -c test.f90
error: Semantic errors in test.f90
./test.f90:3:11: error: 't2' is not a derived type
CLASS(T2), POINTER :: P
^^
```
There is no error if there is no generic interface with the name T2 (user-defined structure constructor):
```
MODULE M
TYPE T1
CLASS(T2), POINTER :: P
END TYPE
TYPE T2
TYPE(T1) T
END TYPE
END MODULE
```
compiles successfully.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzVVEuPmzAQ_jVwGSVyDCThwCHNQ1ppN4kSoqqnyuAhuOtAZJuu9t93gDx2q91WPTZyBDOe-ebxzZDV8jX5qlwJhRbVEeoKXIlwEqqCzIgqL8Hj07w-nZSD0Xg0zmSMRYhZOBZByMR0Mo5QZGHIijjGmLEpY4HHY4_PgbzOSgunCLQuOtyi1rp-URQoryV6wcxjC4_NvDG7nE582iwOj0t46iWA9Nt2CenoKgLMH2f7PeWV8kuo7eZhnS530CIGM9heTZfrRef9HonfkbpLAhoREKSfuXXgq9n8ve92t5kvF4ddq_0-36z36e4wTze7tyg3z15JVunsYb1_m8-1Dlgd1vP0YbP-HY5P2yrfgF4Ne12r6Tv2YTMN2kY7C0SoqACNqc1nffd4eBmDQQ4OrRsW8eXq6gd7PInKqbxH6mDfWw49vrppgllA_9Go9bxBeHziqOAJKAtV7UCARKN-ogT3esZ7f_-B5_vPi5bt-ai8tESDfdA-GVDdVN6UR6wokZxqcmgKkSO8tJvRDm4lTki8tMvQWDQDiYWqKGPrTJO7hiDyuuoFKpKS_T9G-y-z028wWrBNnqO1RaP169CXSSDjIBa-U05jssBcC3Pb8xudg5ZOONddO6EQSttLxzuiQTmLumh7LzsEaqcoyPRFGGlpWOWdHPEnbmzLTUuQ3xidlM6dbdssvqJzJKMmG1IhJGj98_oYnE39A3NHorK2QUsvURQw5pdJxiLM8lByiVkk4kzyaBJyHE0iGTDJpK9FhtomXvTF47zCF-gg6N2LFr5KOOOcRWzMpvSFHA_JQ9J3k8nJKBcZGYWMdkjpYZvHsDZH3yRdSllztHSplXX2fimsVccKsQtH-KJxZW2SvFRaPavq2e-CJ13yvwCOjql7">