[llvm-bugs] [Bug 52138] New: Class with same name as module causes compilation error due to incorrect resolution to forward declaration in another module
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Oct 11 11:00:27 PDT 2021
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: unassignedclangbugs at nondot.org
Reporter: rhow at fb.com
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211011/0fe8f10e/attachment.html>
More information about the llvm-bugs
mailing list