Issue 126114
Summary [Flang] Incorrect diagnostic on valid private component name to be the same as parent component
Labels flang:frontend
Assignees
Reporter DanielCChen
    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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to