<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/81876>81876</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] Typed procedure pointer with implicit interface cannot pointer assign to a function reference that returns a procedure pointer with the explicit interface that has the same TKR.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang:frontend,
flang,
flang:semantics
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
DanielCChen
</td>
</tr>
</table>
<pre>
Consider the following code:
```
interface
integer function bar()
end
function foo()
import
procedure(bar), pointer :: foo
end
end interface
procedure(integer), pointer :: p1
p1 => foo()
end
```
Flang currently issues an error as:
```
error: Semantic errors in t.f
./t.f:10:1: error: Procedure pointer 'p1' associated with result of reference to function 'foo' that is an incompatible procedure pointer: incompatible procedure attributes: ImplicitInterface
p1 => foo()
^^^^^^^^^^^
./t.f:9:32: Declaration of 'p1'
procedure(integer), pointer :: p1
^^
```
According to the standard (F2018) [10.2.2.4 Procedure pointer assignment]
"
5. If the pointer object has an implicit interface and is explicitly typed or referenced as a function, the pointer target
shall be a function. ....
6 If the pointer object is a function with an implicit interface, the pointer target shall be a function with the same
type; corresponding type parameters shall have the same value.
"
It seems the above code is conforming.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVd2uozYQfhpzM1oEJoRwwUVOspGOelO1-wLGHoIrYyPbnG3evrIhhE0TVZUQieOZ-ebnmy_MOXnViA0pP0h5Ttjke2ObM9MS1enUo05aI27NyWgnBVrwPUJnlDI_pb4CNwJJcSTZmWRHss-WJx6l9mg7xnE-AoQfrmihmzT30mhomSX0QGi9WKAWd9vVpjPmFxsAOYzG-vU4WsNRTBYJPcSANaEnGE2Eh5BccYxRnjBQC3hKcRtqSfZ1uDFfHHIgxZkU35_TXFGeejK_L4qF3k3WovbqBtK5CR0wDWitscDcu57G-5DBnzgw7SWfPRxIDT7tZqOU0Es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