<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/126114>126114</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] Incorrect diagnostic on valid private component name to be the same as parent component
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang:frontend
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
DanielCChen
</td>
</tr>
</table>
<pre>
Consider the following code
```
module m
type base
integer*4, private :: base = 1 !! Not accessible outside of the module
end type
end module
program main
use m
type, extends(base) :: child
character(20) :: name
end type
end
```
Flang currently issues an error as:
```
./t2.f:9:19: error: Type cannot be extended as it has a component named 'base'
type, extends(base) :: child
^^^^
./t2.f:3:31: Previous declaration of 'base'
integer*4, private :: base = 1 !! Not accessible outside of the module
^^^^
```
The code is valid as the name collision is by the scoping rule. The private component `integer :: base` is not accessible from outside of the module.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy0lEGTqzYMxz-NuGgeY5tA4MCB7jYzvXR6eF_A2ALcMTZjm7T77TsmvLeb7R56aYYkeCxLP_0lWcZoZkfUQ_0L1K-F3NPiQ_8qnSH78rKQK0av3_oX76LRFDAthJO31v9l3IzKawI2QMPOhw2r17slXIENiIjpbSMcZaRznT_GJZopgBguIF5wC-YuEyFUA1TDYYxQvSJHRBAcBMfffUKpFMVoRkvo95Rp0E8HzyPkGYCcPoICG_Lrzz1gwxb8HOSKqzQO2LDHZ8zMQn8ncjqCaA9m0f2gUouxOhurRQapUsZvBftg4eT6NcMj-EeNgA03K7N-ewjkkn1DE-NOEaVDCsEHlDG7fT5WgrglUU5QDR1UA88_D_P88j0rraRzPuFIZyakUUY0CRcZUaLy6-YduXTQagRxfeR5_Vme_64E1L--P090Vf7ybPxHoLvxe0RNysogk_Eul-2LwP9vZ3yC_VSN7wsdvYwm4l1ac6iWHWSZUHlrTczkJuL4dmxE5bc8AWG3VGI-_wP2XWNo2JnQxwygYdmPewafgl-_pi8L3Ve6qzpZUM-vVds23bVui6XvuoY3otNUX2ul24viE5ftZaKq5W0tr4XpBRM1E6zhnRBVW7aaX1nLG1Hri-haCRdGqzS2tPa-lj7MxdGHPRcN55fCypFsPO4GIabcsVANU_AutwYIkW-M0Oez38Z9jnBh1sQU370lk-xxtxztDvUr_uaUD4FUQm3k7HxMRqF3p-r_1vAoQPK5ow_Z81JG3GSem3e7Yg-2X1LajrERNxC32aRlH0vlVxC3THT-fduC_5NUAnF7DB2I25nvvRf_BAAA__-yLpEW">