https://bugs.llvm.org/show_bug.cgi?id=52138
Bug ID: 52138
Summary: Class with same name as module causes compilation
error due to incorrect resolution to forward
declaration in another module
Product: clang
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Modules
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected]
Created attachment 25349
--> https://bugs.llvm.org/attachment.cgi?id=25349&action=edit
test case
During a migration to using submodules for some of our libraries we have come
across an edge case where a type with the same name as its containing module is
not found in its imported module, but instead incorrectly located in an
unimported submodule that contains a forward declaration to that type.
I have attached a test case that illustrates the issue. Running the `build.sh`
script results in:
```
test.m:7:21: error: definition of 'c' must be imported from module 'b.b2'
before it is required
return a.cthing.d;
^
./b2.h:2:8: note: definition here is not reachable
@class c;
^
1 error generated.
```
Where test.m imports c.h that defines c:
```
#import "a.h"
#import "c.h"
int test(AClass *a);
int test(AClass *a) {
return a.cthing.d;
}
```
Changing the order of imports, the name of the module or the name of the class
will compile correctly.
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs